diff options
author | Jean Delvare <jdelvare@suse.de> | 2016-09-15 14:05:29 +0200 |
---|---|---|
committer | Jean Delvare <jdelvare@suse.de> | 2016-09-15 14:06:11 +0200 |
commit | 20f06212baced666027131555ad4c834d8e4b232 (patch) | |
tree | b4c441561b258891ff1d12ce537158ea29a7b122 | |
parent | 6fc4c833bf7ff9a9f8b2e2d3240bfe383439f752 (diff) | |
download | quilt-20f06212baced666027131555ad4c834d8e4b232.tar.gz |
Reject binary files in patches
Since diffutils version 3.4, diff no longer returns an error code for
binary files. Parse the first line of the output to detect this case
and raise our own error.
-rw-r--r-- | quilt/scripts/patchfns.in | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in index 521e92d..a496f3b 100644 --- a/quilt/scripts/patchfns.in +++ b/quilt/scripts/patchfns.in @@ -741,6 +741,12 @@ diff_file() "$old_file" "$new_file" \ | if read line then + if [[ "$line" =~ ^Binary\ files\ .*\ differ$ ]] + then + echo "$line" + return 1 + fi + if [ -z "$QUILT_NO_DIFF_INDEX" ] then echo "Index: $index" @@ -751,7 +757,7 @@ diff_file() fi # Test the return value of diff, and propagate the error retcode if any - if [ ${PIPESTATUS[0]} == 2 ] + if [ ${PIPESTATUS[0]} == 2 -o ${PIPESTATUS[1]} == 1 ] then return 1 fi |