diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-12-22 12:18:08 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-12-22 12:18:08 -0800 |
commit | 0eeb9b86d686fb4f1f833890a6e5d880e7e78109 (patch) | |
tree | bbc687843a8ca88771d28494f69abc1bba3daeee /t/t5528-push-default.sh | |
parent | Merge branch 'mh/config-flip-xbit-back-after-checking' into maint (diff) | |
parent | push: truly use "simple" as default, not "upstream" (diff) | |
download | tgif-0eeb9b86d686fb4f1f833890a6e5d880e7e78109.tar.xz |
Merge branch 'jk/push-simple' into maint
Git 2.0 was supposed to make the "simple" mode for the default of
"git push", but it didn't.
* jk/push-simple:
push: truly use "simple" as default, not "upstream"
Diffstat (limited to 't/t5528-push-default.sh')
-rwxr-xr-x | t/t5528-push-default.sh | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/t/t5528-push-default.sh b/t/t5528-push-default.sh index 6a5ac3add4..cc7451908b 100755 --- a/t/t5528-push-default.sh +++ b/t/t5528-push-default.sh @@ -26,7 +26,7 @@ check_pushed_commit () { # $2 = expected target branch for the push # $3 = [optional] repo to check for actual output (repo1 by default) test_push_success () { - git -c push.default="$1" push && + git ${1:+-c push.default="$1"} push && check_pushed_commit HEAD "$2" "$3" } @@ -34,7 +34,7 @@ test_push_success () { # check that push fails and does not modify any remote branch test_push_failure () { git --git-dir=repo1 log --no-walk --format='%h %s' --all >expect && - test_must_fail git -c push.default="$1" push && + test_must_fail git ${1:+-c push.default="$1"} push && git --git-dir=repo1 log --no-walk --format='%h %s' --all >actual && test_cmp expect actual } @@ -172,4 +172,32 @@ test_pushdefault_workflow success simple master triangular # master is updated (parent2 does not have foo) test_pushdefault_workflow success matching master triangular +# default tests, when no push-default is specified. This +# should behave the same as "simple" in non-triangular +# settings, and as "current" otherwise. + +test_expect_success 'default behavior allows "simple" push' ' + test_config branch.master.remote parent1 && + test_config branch.master.merge refs/heads/master && + test_config remote.pushdefault parent1 && + test_commit default-master-master && + test_push_success "" master +' + +test_expect_success 'default behavior rejects non-simple push' ' + test_config branch.master.remote parent1 && + test_config branch.master.merge refs/heads/foo && + test_config remote.pushdefault parent1 && + test_commit default-master-foo && + test_push_failure "" +' + +test_expect_success 'default triangular behavior acts like "current"' ' + test_config branch.master.remote parent1 && + test_config branch.master.merge refs/heads/foo && + test_config remote.pushdefault parent2 && + test_commit default-triangular && + test_push_success "" master repo2 +' + test_done |