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