| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
# This is a combinediff(1) testcase. |
| 4 |
# Bug report: combinediff produces incorrect file path prefixes |
| 5 |
# Expected: diff -u a/file.c a/file.c |
| 6 |
# Actual: diff -u b/file.c b/file.c |
| 7 |
# |
| 8 |
# This test expects the correct behavior and will fail until the bug is fixed. |
| 9 |
# It's added to XFAIL_TESTS to mark it as an expected failure. |
| 10 |
|
| 11 |
. ${top_srcdir-.}/tests/common.sh |
| 12 |
|
| 13 |
# Create the patch files from the bug report |
| 14 |
cat << EOF > first.patch |
| 15 |
--- a/file.c |
| 16 |
+++ b/file.c |
| 17 |
@@ -0,0 +1,3 @@ |
| 18 |
+a |
| 19 |
+b |
| 20 |
+c |
| 21 |
EOF |
| 22 |
|
| 23 |
cat << EOF > second.patch |
| 24 |
--- a/file.c |
| 25 |
+++ b/file.c |
| 26 |
@@ -1,3 +1,2 @@ |
| 27 |
a |
| 28 |
b |
| 29 |
-c |
| 30 |
EOF |
| 31 |
|
| 32 |
# Run combinediff with -p1 as mentioned in the bug report |
| 33 |
${COMBINEDIFF} -p1 first.patch second.patch 2>errors >combined.patch || exit 1 |
| 34 |
[ -s errors ] && exit 1 |
| 35 |
|
| 36 |
# Check that the combined patch exists and is not empty |
| 37 |
[ -s combined.patch ] || exit 1 |
| 38 |
|
| 39 |
# Check that the combined patch has the correct header format |
| 40 |
head -3 combined.patch > header |
| 41 |
cat << EOF > expected |
| 42 |
diff -u a/file.c b/file.c |
| 43 |
--- a/file.c |
| 44 |
+++ b/file.c |
| 45 |
EOF |
| 46 |
cmp header expected || exit 1 |