#!/bin/sh # Test combinediff with multiple path levels requiring -p2 # This tests the automatic detection of deeper path stripping . ${top_srcdir-.}/tests/common.sh # Create first patch with deeply nested path cat << EOF > patch1 --- /dev/null +++ b/src/deep/nested/file.c @@ -0,0 +1,2 @@ +#include +int main() { return 0; } EOF # Create second patch modifying the same file with different path prefix cat << EOF > patch2 --- a/src/deep/nested/file.c +++ b/src/deep/nested/file.c @@ -1,2 +1,3 @@ #include +#include int main() { return 0; } EOF # Expected combined output (should auto-detect -p1) cat << EOF > expected diff -u /dev/null b/src/deep/nested/file.c --- /dev/null +++ b/src/deep/nested/file.c @@ -0,0 +1,3 @@ +#include +#include +int main() { return 0; } EOF # Run combinediff ${COMBINEDIFF} patch1 patch2 2>errors >actual || exit 1 [ -s errors ] && exit 1 # Compare the actual output with expected diff -u expected actual || exit 1 exit 0