X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft5516-fetch-push.sh;h=f9e878022a93657a8b8d81339670f4d910392755;hb=27f64962f1a573126c0e85cb7c83aa75b669ce07;hp=f0030ad00e4a6478fcb3ccfc503e576bd58003bd;hpb=faf1dc7223be9ffddf775916913bb8e22762cdfb;p=git.git diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index f0030ad00..f9e878022 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -437,6 +437,37 @@ test_expect_success 'push updates local refs' ' ' +test_expect_success 'push updates up-to-date local refs' ' + + rm -rf parent child && + mkdir parent && + (cd parent && git init && + echo one >foo && git add foo && git commit -m one) && + git clone parent child1 && + git clone parent child2 && + (cd child1 && + echo two >foo && git commit -a -m two && + git push) && + (cd child2 && + git pull ../child1 master && + git push && + test $(git rev-parse master) = $(git rev-parse remotes/origin/master)) + +' + +test_expect_success 'push preserves up-to-date packed refs' ' + + rm -rf parent child && + mkdir parent && + (cd parent && git init && + echo one >foo && git add foo && git commit -m one) && + git clone parent child && + (cd child && + git push && + ! test -f .git/refs/remotes/origin/master) + +' + test_expect_success 'push does not update local refs on failure' ' rm -rf parent child && @@ -463,4 +494,54 @@ test_expect_success 'allow deleting an invalid remote ref' ' ' +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