test: fetch/receive with fsckobjects
Add tests for the new fetch.fsckobjects, and also tests for receive.fsckobjects we have had for quite some time. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Sep 4, 2011 at 18:19 UTC
b10a53583f5725b796de630c946e41bbd48fcfe2
1 file changed
+104
t/t5504-fetch-receive-strict.sh
new
+104
@@ -0,0 +1,104 @@
1
+#!/bin/sh
2
+
3
+test_description='fetch/receive strict mode'
4
+. ./test-lib.sh
5
+
6
+test_expect_success setup '
7
+ echo hello >greetings &&
8
+ git add greetings &&
9
+ git commit -m greetings &&
10
+
11
+ S=$(git rev-parse :greetings | sed -e "s|^..|&/|") &&
12
+ X=$(echo bye | git hash-object -w --stdin | sed -e "s|^..|&/|") &&
13
+ mv -f .git/objects/$X .git/objects/$S &&
14
+
15
+ test_must_fail git fsck
16
+'
17
+
18
+test_expect_success 'fetch without strict' '
19
+ rm -rf dst &&
20
+ git init dst &&
21
+ (
22
+ cd dst &&
23
+ git config fetch.fsckobjects false &&
24
+ git config transfer.fsckobjects false &&
25
+ git fetch ../.git master
26
+ )
27
+'
28
+
29
+test_expect_success 'fetch with !fetch.fsckobjects' '
30
+ rm -rf dst &&
31
+ git init dst &&
32
+ (
33
+ cd dst &&
34
+ git config fetch.fsckobjects false &&
35
+ git config transfer.fsckobjects true &&
36
+ git fetch ../.git master
37
+ )
38
+'
39
+
40
+test_expect_success 'fetch with fetch.fsckobjects' '
41
+ rm -rf dst &&
42
+ git init dst &&
43
+ (
44
+ cd dst &&
45
+ git config fetch.fsckobjects true &&
46
+ git config transfer.fsckobjects false &&
47
+ test_must_fail git fetch ../.git master
48
+ )
49
+'
50
+
51
+test_expect_success 'fetch with transfer.fsckobjects' '
52
+ rm -rf dst &&
53
+ git init dst &&
54
+ (
55
+ cd dst &&
56
+ git config transfer.fsckobjects true &&
57
+ test_must_fail git fetch ../.git master
58
+ )
59
+'
60
+
61
+test_expect_success 'push without strict' '
62
+ rm -rf dst &&
63
+ git init dst &&
64
+ (
65
+ cd dst &&
66
+ git config fetch.fsckobjects false &&
67
+ git config transfer.fsckobjects false
68
+ ) &&
69
+ git push dst master:refs/heads/test
70
+'
71
+
72
+test_expect_success 'push with !receive.fsckobjects' '
73
+ rm -rf dst &&
74
+ git init dst &&
75
+ (
76
+ cd dst &&
77
+ git config receive.fsckobjects false &&
78
+ git config transfer.fsckobjects true
79
+ ) &&
80
+ git push dst master:refs/heads/test
81
+'
82
+
83
+test_expect_success 'push with receive.fsckobjects' '
84
+ rm -rf dst &&
85
+ git init dst &&
86
+ (
87
+ cd dst &&
88
+ git config receive.fsckobjects true &&
89
+ git config transfer.fsckobjects false
90
+ ) &&
91
+ test_must_fail git push dst master:refs/heads/test
92
+'
93
+
94
+test_expect_success 'push with transfer.fsckobjects' '
95
+ rm -rf dst &&
96
+ git init dst &&
97
+ (
98
+ cd dst &&
99
+ git config transfer.fsckobjects true
100
+ ) &&
101
+ test_must_fail git push dst master:refs/heads/test
102
+'
103
+
104
+test_done