Debian Codegraph @

tests/filterdiff-binary-filtering/run-test

raw
1 #!/bin/sh
2
3 # GitHub issue #157: Binary files should be filtered by file number
4
5 . ${top_srcdir-.}/tests/common.sh
6
7 cat << 'EOF' > diff
8 diff --git a/file1.txt b/file1.txt
9 new file mode 100644
10 --- /dev/null
11 +++ b/file1.txt
12 @@ -0,0 +1 @@
13 +a
14 diff --git a/file1.bin b/file1.bin
15 new file mode 100644
16 Binary files /dev/null and b/file1.bin differ
17 diff --git a/file2.txt b/file2.txt
18 new file mode 100644
19 --- /dev/null
20 +++ b/file2.txt
21 @@ -0,0 +1 @@
22 +b
23 diff --git a/file2.bin b/file2.bin
24 new file mode 100644
25 Binary files /dev/null and b/file2.bin differ
26 EOF
27
28 # Test -F2: should only show file #2 (file1.bin), NOT file2.bin
29 # Note: using --git-extended-diffs=include to test binary file filtering
30 ${FILTERDIFF} --git-extended-diffs=include -F2 diff 2>errors >output || exit 1
31 [ -s errors ] && exit 1
32
33 cat << 'EOF' | cmp - output || exit 1
34 diff --git a/file1.bin b/file1.bin
35 new file mode 100644
36 Binary files /dev/null and b/file1.bin differ
37 EOF