X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft5516-fetch-push.sh;h=f0030ad00e4a6478fcb3ccfc503e576bd58003bd;hb=faf1dc7223be9ffddf775916913bb8e22762cdfb;hp=0a757d5b9fe660245ced7749e445eabd0369bcf0;hpb=008442f5e798e511cc0cd5d9443552b0d107d558;p=git.git diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index 0a757d5b9..f0030ad00 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -105,7 +105,7 @@ test_expect_success 'fetch with insteadOf' ' ( TRASH=$(pwd)/ && cd testrepo && - git config url.$TRASH.insteadOf trash/ + git config "url.$TRASH.insteadOf" trash/ && git config remote.up.url trash/. && git config remote.up.fetch "refs/heads/*:refs/remotes/origin/*" && git fetch up && @@ -145,8 +145,8 @@ test_expect_success 'push with wildcard' ' test_expect_success 'push with insteadOf' ' mk_empty && - TRASH=$(pwd)/ && - git config url.$TRASH.insteadOf trash/ && + TRASH="$(pwd)/" && + git config "url.$TRASH.insteadOf" trash/ && git push trash/testrepo refs/heads/master:refs/remotes/origin/master && ( cd testrepo && @@ -165,6 +165,47 @@ test_expect_success 'push with matching heads' ' ' +test_expect_success 'push with matching heads on the command line' ' + + mk_test heads/master && + git push testrepo : && + check_push_result $the_commit heads/master + +' + +test_expect_success 'failed (non-fast-forward) push with matching heads' ' + + mk_test heads/master && + git push testrepo : && + git commit --amend -massaged && + test_must_fail git push testrepo && + check_push_result $the_commit heads/master && + git reset --hard $the_commit + +' + +test_expect_success 'push --force with matching heads' ' + + mk_test heads/master && + git push testrepo : && + git commit --amend -massaged && + git push --force testrepo && + ! check_push_result $the_commit heads/master && + git reset --hard $the_commit + +' + +test_expect_success 'push with matching heads and forced update' ' + + mk_test heads/master && + git push testrepo : && + git commit --amend -massaged && + git push testrepo +: && + ! check_push_result $the_commit heads/master && + git reset --hard $the_commit + +' + test_expect_success 'push with no ambiguity (1)' ' mk_test heads/master && @@ -333,7 +374,7 @@ test_expect_success 'push with +HEAD' ' # Without force rewinding should fail git reset --hard HEAD^ && - ! git push testrepo HEAD && + test_must_fail git push testrepo HEAD && check_push_result $the_commit heads/local && # With force rewinding should succeed @@ -407,7 +448,7 @@ test_expect_success 'push does not update local refs on failure' ' git clone parent child && (cd child && echo two >foo && git commit -a -m two && - ! git push && + test_must_fail git push && test $(git rev-parse master) != \ $(git rev-parse remotes/origin/master)) @@ -418,7 +459,7 @@ test_expect_success 'allow deleting an invalid remote ref' ' pwd && rm -f testrepo/.git/objects/??/* && git push testrepo :refs/heads/master && - (cd testrepo && ! git rev-parse --verify refs/heads/master) + (cd testrepo && test_must_fail git rev-parse --verify refs/heads/master) '