X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft5516-fetch-push.sh;h=4426df9226535c55eacff80217c4ab70f77639b6;hb=39a76bdd7de18b2bb2651dcb8136563df41e84f7;hp=a6532cb29e311ec90430eea0349179e69d68e2fd;hpb=986e82396ab23b9e5f4eab7183bbf76e7bc756d0;p=git.git diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index a6532cb29..4426df922 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -523,4 +523,54 @@ test_expect_success 'allow push to HEAD of non-bare repository (config)' ' ! grep "warning.*this may cause confusion" stderr ' +test_expect_success 'fetch with branches' ' + mk_empty && + git branch second $the_first_commit && + git checkout second && + echo ".." > testrepo/.git/branches/branch1 && + (cd testrepo && + git fetch branch1 && + r=$(git show-ref -s --verify refs/heads/branch1) && + test "z$r" = "z$the_commit" && + test 1 = $(git for-each-ref refs/heads | wc -l) + ) && + git checkout master +' + +test_expect_success 'fetch with branches containing #' ' + mk_empty && + echo "..#second" > testrepo/.git/branches/branch2 && + (cd testrepo && + git fetch branch2 && + r=$(git show-ref -s --verify refs/heads/branch2) && + test "z$r" = "z$the_first_commit" && + test 1 = $(git for-each-ref refs/heads | wc -l) + ) && + git checkout master +' + +test_expect_success 'push with branches' ' + mk_empty && + git checkout second && + echo "testrepo" > .git/branches/branch1 && + git push branch1 && + (cd testrepo && + r=$(git show-ref -s --verify refs/heads/master) && + test "z$r" = "z$the_first_commit" && + test 1 = $(git for-each-ref refs/heads | wc -l) + ) +' + +test_expect_success 'push with branches containing #' ' + mk_empty && + echo "testrepo#branch3" > .git/branches/branch2 && + git push branch2 && + (cd testrepo && + r=$(git show-ref -s --verify refs/heads/branch3) && + test "z$r" = "z$the_first_commit" && + test 1 = $(git for-each-ref refs/heads | wc -l) + ) && + git checkout master +' + test_done