diff options
author | Jean Delvare <jdelvare@suse.de> | 2014-03-04 21:09:27 +0100 |
---|---|---|
committer | Jean Delvare <jdelvare@suse.de> | 2014-03-04 21:09:27 +0100 |
commit | 1ce592cbeaa592d550d77daee219d306041d4739 (patch) | |
tree | 409610be57c3beea7e395d633f90af8b830b1bdb /test | |
parent | 88899892aceb55b8098d745db19cdd077391ca4c (diff) | |
download | quilt-1ce592cbeaa592d550d77daee219d306041d4739.tar.gz |
diff: Workaround bash bug
Old versions of bash (at least version 3.2.51) don't properly handle
prefix stripping together with quoting when evaluating an array. So
strip the prefix before adding each file to opt_files. It's faster
anyway.
Same thing when diffing against a snapshot, strip the snapshot
directory prefix from file names before evaluating the quoted files
array.
This fixes a regression introduced in:
commit b0baeeb6b61132af92fd75df5f912554d295dee1
Author: Jean Delvare <jdelvare@suse.de>
Date: Fri Mar 25 18:48:49 2011 +0100
diff, refresh: Accept file names with spaces
(Only affecting the versions of bash which have the aforementioned bug.)
This also fixes a bug when called from a subdirectory and a file
passed as an argument starts with "./".
Extend the test suite to test both cases, so that such bugs can't
sneak in in the future.
Diffstat (limited to 'test')
-rw-r--r-- | test/subdir.test | 19 | ||||
-rw-r--r-- | test/three.test | 18 |
2 files changed, 37 insertions, 0 deletions
diff --git a/test/subdir.test b/test/subdir.test index 7310616..7fb28e1 100644 --- a/test/subdir.test +++ b/test/subdir.test @@ -58,5 +58,24 @@ > @@ -1 +0,0 @@ > -yet another file + # Test diff called with multiple file names, from a subdirectory + $ quilt diff --no-index -p ab file file2 no + > --- a/subdir/file + > +++ b/subdir/file + > @@ -1 +1 @@ + > -old file + > +new contents + > --- /dev/null + > +++ b/subdir/file2 + > @@ -0,0 +1 @@ + > +another file + + # Test diff called with "./" file name prefix, from a subdirectory + $ quilt diff --no-index -p ab ./file3 ./no + > --- a/subdir/file3 + > +++ /dev/null + > @@ -1 +0,0 @@ + > -yet another file + $ quilt refresh > Refreshed patch %{_P}test.patch diff --git a/test/three.test b/test/three.test index 204b1c1..7abc835 100644 --- a/test/three.test +++ b/test/three.test @@ -61,6 +61,24 @@ $ quilt refresh > Refreshed patch %{P}patch2.diff + # Test diff called with multiple file names + $ quilt diff -p0 f g + > Index: g + > =================================================================== + > --- /dev/null + > +++ g + > @@ -0,0 +1 @@ + > +g + + # Test that diff strips the "./" prefix + $ quilt diff -p0 ./f ./g + > Index: g + > =================================================================== + > --- /dev/null + > +++ g + > @@ -0,0 +1 @@ + > +g + $ quilt pop > Removing patch patches/patch2.diff > Removing g |