From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH 5/6] t/t5528-push-default: test pushdefault workflows
Date: Sun, 23 Jun 2013 21:33:07 -0700 [thread overview]
Message-ID: <1372048388-16742-6-git-send-email-gitster@pobox.com> (raw)
In-Reply-To: <1372048388-16742-1-git-send-email-gitster@pobox.com>
From: Ramkumar Ramachandra <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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
t/t5528-push-default.sh | 57 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
diff --git a/t/t5528-push-default.sh b/t/t5528-push-default.sh
index db58e7f..6a5ac3a 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,41 @@ test_expect_success 'push to existing branch, upstream configured with different
test_cmp expect-other-name actual-other-name
'
+# We are on 'master', which integrates with 'foo' from parent1
+# remote (set in test_pushdefault_workflow helper). Push to
+# parent1 in centralized, and push to parent2 in triangular workflow.
+# The parent1 repository has 'master' and 'foo' branches, while
+# the parent2 repository has only 'master' branch.
+#
+# 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
+
+# update parent1's master (which is not our upstream)
+test_pushdefault_workflow success current master
+
+# update parent1's foo (which is our upstream)
+test_pushdefault_workflow success upstream foo
+
+# upsream is foo which is not the name of the current branch
+test_pushdefault_workflow failure simple master
+
+# master and foo are updated
+test_pushdefault_workflow success matching master
+
+# master is updated
+test_pushdefault_workflow success current master triangular
+
+# upstream mode cannot be used in triangular
+test_pushdefault_workflow failure upstream foo triangular
+
+# in triangular, 'simple' works as 'current' and update the branch
+# with the same name.
+test_pushdefault_workflow success simple master triangular
+
+# master is updated (parent2 does not have foo)
+test_pushdefault_workflow success matching master triangular
+
test_done
--
1.8.3.1-721-g0a353d3
next prev parent reply other threads:[~2013-06-24 4:33 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-24 4:33 [PATCH 0/6] Reroll of rr/triangular-push-fix Junio C Hamano
2013-06-24 4:33 ` [PATCH 1/6] t/t5528-push-default: remove redundant test_config lines Junio C Hamano
2013-06-24 4:33 ` [PATCH 2/6] config doc: rewrite push.default section Junio C Hamano
2013-06-24 4:33 ` [PATCH 3/6] push: change `simple` to accommodate triangular workflows Junio C Hamano
2013-06-24 6:58 ` Johan Herland
2013-06-24 7:43 ` Junio C Hamano
2013-06-24 7:46 ` Ramkumar Ramachandra
2013-06-24 8:48 ` Johan Herland
2013-06-24 14:13 ` Ramkumar Ramachandra
2013-06-24 7:59 ` Junio C Hamano
2013-06-24 8:48 ` Johan Herland
2013-06-24 4:33 ` [PATCH 4/6] t/t5528-push-default: generalize test_push_* Junio C Hamano
2013-06-24 6:58 ` Johan Herland
2013-06-24 7:28 ` Junio C Hamano
2013-06-24 8:33 ` Johan Herland
2013-06-24 8:44 ` Eric Sunshine
2013-06-24 9:45 ` Johan Herland
2013-06-24 17:21 ` Junio C Hamano
2013-06-24 4:33 ` Junio C Hamano [this message]
2013-06-24 4:33 ` [PATCH 6/6] push: honor branch.*.push Junio C Hamano
2013-06-24 6:58 ` Johan Herland
2013-06-24 7:47 ` Junio C Hamano
2013-06-24 7:58 ` Ramkumar Ramachandra
2013-06-24 8:17 ` Junio C Hamano
2013-06-24 14:19 ` Ramkumar Ramachandra
2013-06-24 15:23 ` Johan Herland
2013-06-24 16:08 ` Junio C Hamano
2013-06-24 15:41 ` Junio C Hamano
2013-06-24 16:09 ` Ramkumar Ramachandra
2013-06-24 16:53 ` Junio C Hamano
2013-06-24 17:13 ` Ramkumar Ramachandra
2013-06-24 18:19 ` Junio C Hamano
2013-06-24 18:23 ` Ramkumar Ramachandra
2013-06-24 7:21 ` [PATCH 0/6] Reroll of rr/triangular-push-fix Ramkumar Ramachandra
2013-06-24 8:12 ` Junio C Hamano
2013-06-24 13:51 ` Ramkumar Ramachandra
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1372048388-16742-6-git-send-email-gitster@pobox.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
/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.
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 NNTP newsgroup(s).