tests: binary diff application.
This adds more tests to cover cases where binary diff application succeeds. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Nov 16, 2005 at 15:52 UTC
fbba222f5de21aafa566430a8ae7cf6f4ab163b1
1 file changed
+39
-10
t/t4103-apply-binary.sh
+39
-10
@@ -35,6 +35,9 @@ git-commit -m 'Second Version'
35
git-diff-tree -p master binary >B.diff
36
git-diff-tree -p -C master binary >C.diff
37
38
+git-diff-tree -p --full-index master binary >BF.diff
39
+git-diff-tree -p --full-index -C master binary >CF.diff
40
+
41
test_expect_success 'stat binary diff -- should not fail.' \
42
'git-checkout master
43
git-apply --stat --summary B.diff'
@@ -59,28 +62,54 @@ test_expect_failure 'check incomplete binary diff with replacement (copy) -- sho
62
'git-checkout master
63
git-apply --check --allow-binary-replacement C.diff'
64
65
+test_expect_success 'check binary diff with replacement.' \
66
+ 'git-checkout master
67
+ git-apply --check --allow-binary-replacement BF.diff'
68
+
69
+test_expect_success 'check binary diff with replacement (copy).' \
70
+ 'git-checkout master
71
+ git-apply --check --allow-binary-replacement CF.diff'
72
+
73
# Now we start applying them.
74
75
+do_reset () {
76
+ rm -f file?
77
+ git-reset --hard
78
+ git-checkout -f master
79
+}
80
+
81
test_expect_failure 'apply binary diff -- should fail.' \
65
- 'git-checkout master
82
+ 'do_reset
83
git-apply B.diff'
84
68
-git-reset --hard
69
-
85
test_expect_failure 'apply binary diff -- should fail.' \
71
- 'git-checkout master
86
+ 'do_reset
87
git-apply --index B.diff'
88
74
-git-reset --hard
75
-
89
test_expect_failure 'apply binary diff (copy) -- should fail.' \
77
- 'git-checkout master
90
+ 'do_reset
91
git-apply C.diff'
92
80
-git-reset --hard
81
-
93
test_expect_failure 'apply binary diff (copy) -- should fail.' \
83
- 'git-checkout master
94
+ 'do_reset
95
git-apply --index C.diff'
96
97
+test_expect_failure 'apply binary diff without replacement -- should fail.' \
98
+ 'do_reset
99
+ git-apply BF.diff'
100
+
101
+test_expect_failure 'apply binary diff without replacement (copy) -- should fail.' \
102
+ 'do_reset
103
+ git-apply CF.diff'
104
+
105
+test_expect_success 'apply binary diff.' \
106
+ 'do_reset
107
+ git-apply --allow-binary-replacement --index BF.diff &&
108
+ test -z "$(git-diff --name-status binary)"'
109
+
110
+test_expect_success 'apply binary diff (copy).' \
111
+ 'do_reset
112
+ git-apply --allow-binary-replacement --index CF.diff &&
113
+ test -z "$(git-diff --name-status binary)"'
114
+
115
test_done