-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathrun-test
More file actions
executable file
·58 lines (48 loc) · 1.48 KB
/
run-test
File metadata and controls
executable file
·58 lines (48 loc) · 1.48 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/sh
# Test for GitHub Issue #57: Binary files not supported
# This test ensures that binary file diffs are handled correctly
. ${top_srcdir-.}/tests/common.sh
cat << EOF > git-binary.patch
diff --git a/binary-file b/binary-file
new file mode 100644
index 0000000..998a95d
Binary files /dev/null and b/binary-file differ
diff --git a/text-file.txt b/text-file.txt
new file mode 100644
index 0000000..abcdefg
--- /dev/null
+++ b/text-file.txt
@@ -0,0 +1,2 @@
+line 1
+line 2
EOF
# Test that filterdiff includes binary files when they match
${FILTERDIFF} --git-extended-diffs=include --git-prefixes=strip -i binary-file git-binary.patch 2>errors >result || exit 1
[ -s errors ] && exit 1
cat << EOF | cmp - result || exit 1
diff --git a/binary-file b/binary-file
new file mode 100644
index 0000000..998a95d
Binary files /dev/null and b/binary-file differ
EOF
# Test that lsdiff shows binary files
${LSDIFF} --git-extended-diffs=include --git-extended-diffs=include --git-prefixes=strip git-binary.patch 2>errors2 >result2 || exit 1
[ -s errors2 ] && exit 1
cat << EOF | cmp - result2 || exit 1
binary-file
text-file.txt
EOF
# Test excluding binary files
${FILTERDIFF} --git-extended-diffs=include --git-prefixes=strip -x binary-file git-binary.patch 2>errors3 >result3 || exit 1
[ -s errors3 ] && exit 1
cat << EOF | cmp - result3 || exit 1
diff --git a/text-file.txt b/text-file.txt
new file mode 100644
index 0000000..abcdefg
--- /dev/null
+++ b/text-file.txt
@@ -0,0 +1,2 @@
+line 1
+line 2
EOF
exit 0