3 test_description='check quarantine of objects during push'
6 test_expect_success 'create picky dest repo' '
7 git init --bare dest.git &&
8 write_script dest.git/hooks/pre-receive <<-\EOF
9 while read old new ref; do
10 test "$(git log -1 --format=%s $new)" = reject && exit 1
16 test_expect_success 'accepted objects work' '
18 git push dest.git HEAD &&
19 commit=$(git rev-parse HEAD) &&
20 git --git-dir=dest.git cat-file commit $commit
23 test_expect_success 'rejected objects are not installed' '
25 commit=$(git rev-parse HEAD) &&
26 test_must_fail git push dest.git reject &&
27 test_must_fail git --git-dir=dest.git cat-file commit $commit
30 test_expect_success 'rejected objects are removed' '
31 echo "incoming-*" >expect &&
32 (cd dest.git/objects && echo incoming-*) >actual &&
33 test_cmp expect actual
36 test_expect_success 'updating a ref from quarantine is forbidden' '
37 git init --bare update.git &&
38 write_script update.git/hooks/pre-receive <<-\EOF &&
40 git update-ref refs/heads/unrelated $new
43 test_must_fail git push update.git HEAD &&
44 git -C update.git fsck