Interested in helping open source friends on HP-UX?
[git/mjg.git] / t / t5504-fetch-receive-strict.sh
blob69ee13c8bebbdb1303378288597420cdf70b7b88
1 #!/bin/sh
3 test_description='fetch/receive strict mode'
4 . ./test-lib.sh
6 test_expect_success setup '
7 echo hello >greetings &&
8 git add greetings &&
9 git commit -m greetings &&
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 &&
15 test_must_fail git fsck
18 test_expect_success 'fetch without strict' '
19 rm -rf dst &&
20 git init dst &&
22 cd dst &&
23 git config fetch.fsckobjects false &&
24 git config transfer.fsckobjects false &&
25 test_must_fail git fetch ../.git master
29 test_expect_success 'fetch with !fetch.fsckobjects' '
30 rm -rf dst &&
31 git init dst &&
33 cd dst &&
34 git config fetch.fsckobjects false &&
35 git config transfer.fsckobjects true &&
36 test_must_fail git fetch ../.git master
40 test_expect_success 'fetch with fetch.fsckobjects' '
41 rm -rf dst &&
42 git init dst &&
44 cd dst &&
45 git config fetch.fsckobjects true &&
46 git config transfer.fsckobjects false &&
47 test_must_fail git fetch ../.git master
51 test_expect_success 'fetch with transfer.fsckobjects' '
52 rm -rf dst &&
53 git init dst &&
55 cd dst &&
56 git config transfer.fsckobjects true &&
57 test_must_fail git fetch ../.git master
61 cat >exp <<EOF
62 To dst
63 ! refs/heads/master:refs/heads/test [remote rejected] (missing necessary objects)
64 EOF
66 test_expect_success 'push without strict' '
67 rm -rf dst &&
68 git init dst &&
70 cd dst &&
71 git config fetch.fsckobjects false &&
72 git config transfer.fsckobjects false
73 ) &&
74 test_must_fail git push --porcelain dst master:refs/heads/test >act &&
75 test_cmp exp act
78 test_expect_success 'push with !receive.fsckobjects' '
79 rm -rf dst &&
80 git init dst &&
82 cd dst &&
83 git config receive.fsckobjects false &&
84 git config transfer.fsckobjects true
85 ) &&
86 test_must_fail git push --porcelain dst master:refs/heads/test >act &&
87 test_cmp exp act
90 cat >exp <<EOF
91 To dst
92 ! refs/heads/master:refs/heads/test [remote rejected] (unpacker error)
93 EOF
95 test_expect_success 'push with receive.fsckobjects' '
96 rm -rf dst &&
97 git init dst &&
99 cd dst &&
100 git config receive.fsckobjects true &&
101 git config transfer.fsckobjects false
102 ) &&
103 test_must_fail git push --porcelain dst master:refs/heads/test >act &&
104 test_cmp exp act
107 test_expect_success 'push with transfer.fsckobjects' '
108 rm -rf dst &&
109 git init dst &&
111 cd dst &&
112 git config transfer.fsckobjects true
113 ) &&
114 test_must_fail git push --porcelain dst master:refs/heads/test >act &&
115 test_cmp exp act
118 test_done