| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# Test for GitHub Issue #27: -x $file only removes the diff body from git diff output |
| 4 |
# This test ensures that when excluding files, no orphaned git headers remain |
| 5 |
|
| 6 |
. ${top_srcdir-.}/tests/common.sh |
| 7 |
|
| 8 |
cat << EOF > git-multi.patch |
| 9 |
diff --git a/README.vin b/README.vin |
| 10 |
index d7a1ea2..7c298d7 100644 |
| 11 |
--- a/README.vin |
| 12 |
+++ b/README.vin |
| 13 |
@@ -1,2 +1,2 @@ |
| 14 |
-old content |
| 15 |
+new content |
| 16 |
some line |
| 17 |
diff --git a/autogen.sh b/autogen.sh |
| 18 |
index 1234567..abcdefg 100644 |
| 19 |
--- a/autogen.sh |
| 20 |
+++ b/autogen.sh |
| 21 |
@@ -1,2 +1,2 @@ |
| 22 |
-old script |
| 23 |
+new script |
| 24 |
EOF |
| 25 |
|
| 26 |
# Test that excluding README.vin removes the entire git diff block |
| 27 |
${FILTERDIFF} --git-extended-diffs=include --git-prefixes=strip -x README.vin git-multi.patch 2>errors >result || exit 1 |
| 28 |
[ -s errors ] && exit 1 |
| 29 |
|
| 30 |
# The result should contain the complete autogen.sh diff, no orphaned headers |
| 31 |
cat << EOF | cmp - result || exit 1 |
| 32 |
diff --git a/autogen.sh b/autogen.sh |
| 33 |
index 1234567..abcdefg 100644 |
| 34 |
--- a/autogen.sh |
| 35 |
+++ b/autogen.sh |
| 36 |
@@ -1,2 +1,2 @@ |
| 37 |
-old script |
| 38 |
+new script |
| 39 |
EOF |
| 40 |
|
| 41 |
# Test that excluding both files results in empty output |
| 42 |
${FILTERDIFF} --git-extended-diffs=include --git-prefixes=strip -x README.vin -x autogen.sh git-multi.patch 2>errors2 >result2 || exit 1 |
| 43 |
[ -s errors2 ] && exit 1 |
| 44 |
|
| 45 |
# The result should be completely empty |
| 46 |
[ -s result2 ] && exit 1 |
| 47 |
|
| 48 |
exit 0 |