git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 4/4] t/push-default: test pushdefault with all modes

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Jun 9, 2013, 17:13 UTC
Message-ID
<1370798000-2358-5-git-send-email-artagnon@gmail.com>
In-Reply-To
<1370798000-2358-1-git-send-email-artagnon@gmail.com>

Introduce test_pushdefault_with_mode() to test that remote.pushdefault works with all the push.default modes correctly. Exercise it with all four modes to illustrate how triangular workflows work, and to guard against regressions.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 t/t5528-push-default.sh | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
diff --git a/t/t5528-push-default.sh b/t/t5528-push-default.sh
index 9ddd3a9..9762515 100755
--- a/t/t5528-push-default.sh
+++ b/t/t5528-push-default.sh
@@ -39,6 +39,19 @@ test_push_failure () {
 	test_cmp expect actual
 }
 
+# $1 = push.default value
+# $2 = branch.master.merge value (master or foo)
+# $3 = branch to check for actual output (master or foo)
+test_pushdefault_with_mode () {
+test_expect_success "push.default = $1 works with remote.pushdefault" "
+	test_config branch.master.remote parent1 &&
+	test_config branch.master.merge refs/heads/$2 &&
+	test_config remote.pushdefault parent2 &&
+	test_commit commit-for-$1 &&
+	test_push_success $1 $3 repo2
+"
+}
+
 test_expect_success '"upstream" pushes to configured upstream' '
 	git checkout master &&
 	test_config branch.master.remote parent1 &&
@@ -115,4 +128,9 @@ test_expect_success 'push to existing branch, upstream configured with different
 	test_cmp expect-other-name actual-other-name
 '
 
+test_pushdefault_with_mode "matching" "foo" "master"
+test_pushdefault_with_mode "upstream" "foo" "foo"
+test_pushdefault_with_mode "simple" "master" "master"
+test_pushdefault_with_mode "current" "foo" "master"
+
 test_done
-- 
1.8.3.247.g485169c
Previous: Ramkumar Ramachandra
Message 16 of 16 in “Fix triangular workflows for upstream, simple”
  1. 0/4 Fix triangular workflows for upstream, simpleRamkumar Ramachandra, Jun 9, 2013
  2. 1/4 t/push-default: remove redundant test_config linesRamkumar Ramachandra, Jun 9, 2013
  3. 2/4 push: make upstream, simple work with pushdefaultRamkumar Ramachandra, Jun 9, 2013
  4. Junio C HamanoJun 9, 2013
  5. Ramkumar RamachandraJun 10, 2013
  6. Junio C HamanoJun 10, 2013
  7. Ramkumar RamachandraJun 10, 2013
  8. Junio C HamanoJun 10, 2013
  9. Ramkumar RamachandraJun 10, 2013
  10. Junio C HamanoJun 10, 2013
  11. Ramkumar RamachandraJun 13, 2013
  12. Junio C HamanoJun 13, 2013
  13. Junio C HamanoJun 13, 2013
  14. Ramkumar RamachandraJun 13, 2013
  15. 3/4 t/push-default: generalize test_push_{success, commit}Ramkumar Ramachandra, Jun 9, 2013
  16. 4/4 t/push-default: test pushdefault with all modesRamkumar Ramachandra, Jun 9, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.