| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# Test interdiff with mode-only patches |
| 4 |
# This tests that interdiff doesn't incorrectly warn "doesn't contain a patch" |
| 5 |
# for patches that only contain mode changes, binary diffs, or merge metadata |
| 6 |
|
| 7 |
. ${top_srcdir-.}/tests/common.sh |
| 8 |
|
| 9 |
# Create first patch - mode-only change (no actual diff content) |
| 10 |
cat << EOF > patch1 |
| 11 |
diff --git a/script.sh b/script.sh |
| 12 |
old mode 100644 |
| 13 |
new mode 100755 |
| 14 |
EOF |
| 15 |
|
| 16 |
# Create second patch - same mode-only change |
| 17 |
cat << EOF > patch2 |
| 18 |
diff --git a/script.sh b/script.sh |
| 19 |
old mode 100644 |
| 20 |
new mode 100755 |
| 21 |
EOF |
| 22 |
|
| 23 |
# Run interdiff - should succeed without the false "doesn't contain a patch" error |
| 24 |
${INTERDIFF} patch1 patch2 2>errors >actual || exit 1 |
| 25 |
|
| 26 |
# The key test: should NOT have "doesn't contain a patch" error |
| 27 |
if grep -q "doesn't contain a patch" errors; then |
| 28 |
echo "FAIL: Got spurious 'doesn't contain a patch' error" |
| 29 |
cat errors |
| 30 |
exit 1 |
| 31 |
fi |
| 32 |
|
| 33 |
# For mode-only patches, interdiff should produce minimal or no output |
| 34 |
# Just verify it ran without error |
| 35 |
exit 0 |