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

[PATCH v5 1/5] t5516: add test case for pushing remote refspecs

From
Glen Choo <chooglen@google.com>
Date
Nov 18, 2021, 00:53 UTC
Message-ID
<20211118005325.64971-2-chooglen@google.com>
In-Reply-To
<20211118005325.64971-1-chooglen@google.com>

"git push remote-name" (that is, with no refspec given on the command line) should push the refspecs in remote.remote-name.push. There is no test case that checks this behavior in detached HEAD, so add one.

Signed-off-by: Glen Choo <chooglen@google.com>
---
 t/t5516-fetch-push.sh | 9 +++++++++
 1 file changed, 9 insertions(+)
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 8212ca56dc..7831a38dde 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -541,6 +541,15 @@ do
 
 done
 
+test_expect_success "push to remote with no explicit refspec and config remote.*.push = src:dest" '
+	mk_test testrepo heads/main &&
+	git checkout $the_first_commit &&
+	test_config remote.there.url testrepo &&
+	test_config remote.there.push refs/heads/main:refs/heads/main &&
+	git push there &&
+	check_push_result testrepo $the_commit heads/main
+'
+
 test_expect_success 'push with remote.pushdefault' '
 	mk_test up_repo heads/main &&
 	mk_test down_repo heads/main &&
-- 
2.33.GIT
Previous: Glen ChooNext: Glen Choo
Message 2 of 7 in “remote: replace static variables with struct remote_state”
  1. 0/5 remote: replace static variables with struct remote_stateGlen Choo, Nov 18, 2021
  2. 1/5 t5516: add test case for pushing remote refspecsGlen Choo, Nov 18, 2021
  3. 2/5 remote: move static variables into per-repository structGlen Choo, Nov 18, 2021
  4. 3/5 remote: use remote_state parameter internallyGlen Choo, Nov 18, 2021
  5. 4/5 remote: remove the_repository->remote_state from static methodsGlen Choo, Nov 18, 2021
  6. 5/5 remote: die if branch is not found in repositoryGlen Choo, Nov 18, 2021
  7. Jonathan TanNov 18, 2021

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.