1#!/bin/sh 2 3test_description='check quarantine of objects during push' 4. ./test-lib.sh 5 6test_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 11 done 12 exit 0 13 EOF 14' 15 16test_expect_success 'accepted objects work'' 17 test_commit ok && 18 git push dest.git HEAD && 19 commit=$(git rev-parse HEAD)&& 20 git --git-dir=dest.git cat-file commit$commit 21' 22 23test_expect_success 'rejected objects are not installed'' 24 test_commit reject && 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 28' 29 30test_expect_success 'rejected objects are removed'' 31 echo "incoming-*" >expect && 32 (cd dest.git/objects && echo incoming-*) >actual && 33 test_cmp expect actual 34' 35 36# MINGW does not allow colons in pathnames in the first place 37test_expect_success !MINGW 'push to repo path with colon'' 38 # The interesting failure case here is when the 39 # receiving end cannot access its original object directory, 40 # so make it likely for us to generate a delta by having 41 # a non-trivial file with multiple versions. 42 43 test-genrandom foo 4096 >file.bin && 44 git add file.bin && 45 git commit -m bin && 46 git clone --bare . xxx:yyy.git && 47 48 echo change >>file.bin && 49 git commit -am change && 50 # Note that we have to use the full path here, or it gets confused 51 # with the ssh host:path syntax. 52 git push "$PWD/xxx:yyy.git" HEAD 53' 54 55test_done