3 test_description
='check quarantine of objects during push'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 test_expect_success
'create picky dest repo' '
9 git init --bare dest.git &&
10 test_hook --setup -C dest.git pre-receive <<-\EOF
11 while read old new ref; do
12 test "$(git log -1 --format=%s $new)" = reject && exit 1
18 test_expect_success
'accepted objects work' '
20 git push dest.git HEAD &&
21 commit=$(git rev-parse HEAD) &&
22 git --git-dir=dest.git cat-file commit $commit
25 test_expect_success
'rejected objects are not installed' '
27 commit=$(git rev-parse HEAD) &&
28 test_must_fail git push dest.git reject &&
29 test_must_fail git --git-dir=dest.git cat-file commit $commit
32 test_expect_success
'rejected objects are removed' '
33 echo "incoming-*" >expect &&
34 (cd dest.git/objects && echo incoming-*) >actual &&
35 test_cmp expect actual
38 test_expect_success
'push to repo path with path separator (colon)' '
39 # The interesting failure case here is when the
40 # receiving end cannot access its original object directory,
41 # so make it likely for us to generate a delta by having
42 # a non-trivial file with multiple versions.
44 test-tool genrandom foo 4096 >file.bin &&
48 if test_have_prereq MINGW
54 git clone --bare . "xxx${pathsep}yyy.git" &&
56 echo change >>file.bin &&
57 git commit -am change &&
58 # Note that we have to use the full path here, or it gets confused
59 # with the ssh host:path syntax.
60 git push "$(pwd)/xxx${pathsep}yyy.git" HEAD
63 test_expect_success
'updating a ref from quarantine is forbidden' '
64 git init --bare update.git &&
65 test_hook -C update.git pre-receive <<-\EOF &&
67 git update-ref refs/heads/unrelated $new
70 test_must_fail git push update.git HEAD &&
71 git -C update.git fsck