From: Ramkumar Ramachandra Date: Wed, 19 Jun 2013 11:11:44 GMT Subject: [PATCH 6/6] t/t5528-push-default: test pushdefault workflows Message-ID: <1371640304-26019-7-git-send-email-artagnon@gmail.com> In-Reply-To: <1371640304-26019-1-git-send-email-artagnon@gmail.com> Introduce test_pushdefault_workflows(), and test that all push.default modes work with central and triangular workflows as expected. Signed-off-by: Ramkumar Ramachandra --- t/t5528-push-default.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/t/t5528-push-default.sh b/t/t5528-push-default.sh index b599186..eabc09d 100755 --- a/t/t5528-push-default.sh +++ b/t/t5528-push-default.sh @@ -39,6 +39,26 @@ test_push_failure () { test_cmp expect actual } +# $1 = success or failure +# $2 = push.default value +# $3 = branch to check for actual output (master or foo) +# $4 = [optional] switch to triangular workflow +test_pushdefault_workflow () { + workflow=central + pushdefault=parent1 + if test -n "${4-}"; then + workflow=triangular + pushdefault=parent2 + fi +test_expect_success "push.default = $2 $1 in $workflow workflows" " + test_config branch.master.remote parent1 && + test_config branch.master.merge refs/heads/foo && + test_config remote.pushdefault $pushdefault && + test_commit commit-for-$2${4+-triangular} && + test_push_$1 $2 $3 ${4+repo2} +" +} + test_expect_success '"upstream" pushes to configured upstream' ' git checkout master && test_config branch.master.remote parent1 && @@ -115,4 +135,20 @@ test_expect_success 'push to existing branch, upstream configured with different test_cmp expect-other-name actual-other-name ' +## test_pushdefault_workflow() arguments: +# $1 = success or failure +# $2 = push.default value +# $3 = branch to check for actual output (master or foo) +# $4 = [optional] switch to triangular workflow + +test_pushdefault_workflow success current master # breaks push/pull symmetry +test_pushdefault_workflow success upstream foo # preserves push/pull symmetry +test_pushdefault_workflow failure simple master # errors out on asymmetry +test_pushdefault_workflow success matching master # always works + +test_pushdefault_workflow success current master triangular # always works +test_pushdefault_workflow failure upstream foo triangular # always errors out +test_pushdefault_workflow success simple master triangular # works like current +test_pushdefault_workflow success matching master triangular # always works + test_done -- 1.8.3.1.454.g30263f3.dirty