git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Git List <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 6/6] t/t5528-push-default: test pushdefault workflows
Date: Wed, 19 Jun 2013 16:41:44 +0530	[thread overview]
Message-ID: <1371640304-26019-7-git-send-email-artagnon@gmail.com> (raw)
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 <artagnon@gmail.com>
---
 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

  parent reply	other threads:[~2013-06-19 11:15 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-19 11:11 [PATCH 0/6] push.default in the triangular world Ramkumar Ramachandra
2013-06-19 11:11 ` [PATCH 1/6] t/t5528-push-default: remove redundant test_config lines Ramkumar Ramachandra
2013-06-19 19:26   ` Junio C Hamano
2013-06-19 11:11 ` [PATCH 2/6] config doc: rewrite push.default section Ramkumar Ramachandra
2013-06-19 19:55   ` Junio C Hamano
2013-06-20  3:27     ` Junio C Hamano
2013-06-20  7:35       ` Johan Herland
2013-06-19 11:11 ` [PATCH 3/6] push: change `simple` to accommodate triangular workflows Ramkumar Ramachandra
2013-06-19 20:00   ` Junio C Hamano
2013-06-20  2:57     ` Junio C Hamano
2013-06-20 10:09       ` Ramkumar Ramachandra
2013-06-20 19:23         ` Junio C Hamano
2013-06-20 20:49           ` Philip Oakley
2013-06-20 21:03             ` Junio C Hamano
2013-06-20 21:22           ` Ramkumar Ramachandra
2013-06-20 21:56             ` Junio C Hamano
2013-06-20 22:05               ` Junio C Hamano
2013-06-20 21:41       ` Junio C Hamano
2013-06-19 11:11 ` [PATCH 4/6] push: remove dead code in setup_push_upstream() Ramkumar Ramachandra
2013-06-19 20:01   ` Junio C Hamano
2013-06-19 11:11 ` [PATCH 5/6] t/t5528-push-default: generalize test_push_* Ramkumar Ramachandra
2013-06-19 21:56   ` Junio C Hamano
2013-06-19 11:11 ` Ramkumar Ramachandra [this message]
2013-06-19 22:17   ` [PATCH 6/6] t/t5528-push-default: test pushdefault workflows Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1371640304-26019-7-git-send-email-artagnon@gmail.com \
    --to=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).