summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2003-02-02 15:47:24 +0000
committerAndreas Gruenbacher <agruen@suse.de>2003-02-02 15:47:24 +0000
commit734afb59685219380ef06590e2f4ead7ea387e5a (patch)
treee8ebe5ba0303557d914c2e408e26a85f0a2240af /scripts
parent69fd8b2d0bb3b4eb9c41412103193dd76d4e7099 (diff)
downloadquilt-734afb59685219380ef06590e2f4ead7ea387e5a.tar.gz
Fix spurious "Index:" lines bug
Diffstat (limited to 'scripts')
-rw-r--r--scripts/patchfns.in27
1 files changed, 15 insertions, 12 deletions
diff --git a/scripts/patchfns.in b/scripts/patchfns.in
index 57a3ab2..332752d 100644
--- a/scripts/patchfns.in
+++ b/scripts/patchfns.in
@@ -441,7 +441,7 @@ stripit()
then
echo $1 |
sed -e 's/^\(\.\/\)*//' \
- -e 's/^'"$(quote_bre $P)"'patches\///' -e 's/^\.pc\///' \
+ -e 's/^'"$(quote_bre $P)"'patches\///' \
-e 's/\.gz$//' -e 's/\.bz2$//' \
-e 's/\.patch$//' -e 's/\.diff\?$//'
fi
@@ -514,17 +514,23 @@ refresh_file_list()
fi
}
+fix_diff_header()
+{
+ local from=$1 to=$2
+ sed -e 's/^--- [^ \t]*/--- '"$(quote_bre $from)"'/' \
+ -e 's/^+++ [^ \t]*/+++ '"$(quote_bre $to)"'/'
+}
+
diff_file()
{
local file=$1 suffix=$2 old_file=$3 new_file=$4
- local old_file new_file
+ local old_hdr new_hdr line
if [ ! -e "$old_file" -a ! -e "$new_file" ]
then
echo "File $file does not exist" >&2
return 0
fi
- local old_hdr new_hdr
if [ $opt_strip_level -eq 0 ]
then
old_hdr=$file$suffix
@@ -535,16 +541,13 @@ diff_file()
new_hdr=$dir/$file
fi
- echo Index: $new_hdr
@DIFF@ -Nu $DIFF_OPTS $old_file $new_file |
- fix_diff_header $old_hdr $new_hdr
-}
-
-fix_diff_header()
-{
- local from=$1 to=$2
- sed -e 's/^--- [^ \t]*/--- '"$(quote_bre $from)"'/' \
- -e 's/^+++ [^ \t]*/+++ '"$(quote_bre $to)"'/'
+ if read line
+ then
+ echo "Index: $new_hdr"
+ (echo "$line" ; cat) \
+ | fix_diff_header $old_hdr $new_hdr
+ fi
}
cat_file()