summaryrefslogtreecommitdiffstats
path: root/test/faildiff.test
diff options
context:
space:
mode:
authorMartin Quinson <martin.quinson@loria.fr>2014-01-19 09:32:13 +0100
committerJean Delvare <jdelvare@suse.de>2014-01-19 09:32:13 +0100
commit67df4ea672028c3178f0c8bb0e636006bc6496c2 (patch)
treecfcf3c2a8ae5972e86d0fcb2b892721f8bfc252e /test/faildiff.test
parentd813126fa1c9789de894b2029a71ea4b1c2b4ade (diff)
downloadquilt-67df4ea672028c3178f0c8bb0e636006bc6496c2.tar.gz
Exit with an error when diff's retcode=2 (error) on patch refresh
This is trigered e.g. when you try to add a binary file to a patch. This is actually creepy to think that we were not checking the retcode of diff :)
Diffstat (limited to 'test/faildiff.test')
-rw-r--r--test/faildiff.test38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/faildiff.test b/test/faildiff.test
new file mode 100644
index 0000000..02705b5
--- /dev/null
+++ b/test/faildiff.test
@@ -0,0 +1,38 @@
+ $ mkdir patches
+
+ $ quilt new test.diff
+ > Patch %{P}test.diff is now on top
+
+ $ cat > test.txt
+ < This is test.txt.
+ $ quilt add test.txt
+ > File test.txt added to patch %{P}test.diff
+
+What happens when diff fails because of a permission error?
+
+ $ chmod -r test.txt
+
+ $ quilt refresh
+ > diff: test.txt: Permission denied
+ > Diff failed on file 'test.txt', aborting
+ $ echo %{?}
+ > 1
+
+ $ chmod +r test.txt
+
+What happens on binary files?
+
+ $ printf "\\002\\000\\001" > test.bin
+ $ quilt add test.bin
+ > File test.bin added to patch %{P}test.diff
+
+ $ printf "\\003\\000\\001" > test.bin
+ $ quilt diff -pab --no-index
+ >~ (Files|Binary files) a/test\.bin and b/test\.bin differ
+ $ echo %{?}
+ > 1
+
+ $ quilt refresh
+ > Diff failed on file 'test.bin', aborting
+ $ echo %{?}
+ > 1