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

Re: [PATCH v3 6/6] remote rename/remove: gently handle remote.pushDefault config

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 29, 2020, 06:57 UTC
Message-ID
<xmqqv9ou6983.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<965b587f5834c88532476b56da95ead605d16000.1580110970.git.bert.wesarg@googlemail.com>
Bert Wesarg <bert.wesarg@googlemail.com> writes:
Show 12 quoted lines
> diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
> index 082042b05a..bbff8c5770 100755
> --- a/t/t5505-remote.sh
> +++ b/t/t5505-remote.sh
> @@ -737,6 +737,7 @@ test_expect_success 'rename a remote' '
>  	git clone one four &&
>  	(
>  		cd four &&
> +		test_config_global remote.pushDefault origin &&
>  		git config branch.master.pushRemote origin &&
>  		git remote rename origin upstream &&
>  		test -z "$(git for-each-ref refs/remotes/origin)" &&

You cannot use test_config and test_config_global inside a subshell, as they rely on test_when_finished to rewind their effect, which cannot be used inside a subshell. As you are doing "global" config, there is no reason to make "git config --global" call in a particular repository anyway, so just do this upfront as the first thing in the test sequence. There are a few others in this file.

Tentatively I applied the following fix-up on top of the series to unblock tonight's integration cycle.

Thanks.
 t/t5505-remote.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index bbff8c5770..dda81b7d07 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -734,10 +734,10 @@ test_expect_success 'reject adding remote with an invalid name' '
 # the last two ones check if the config is updated.
 
 test_expect_success 'rename a remote' '
+	test_config_global remote.pushDefault origin &&
 	git clone one four &&
 	(
 		cd four &&
-		test_config_global remote.pushDefault origin &&
 		git config branch.master.pushRemote origin &&
 		git remote rename origin upstream &&
 		test -z "$(git for-each-ref refs/remotes/origin)" &&
@@ -761,10 +761,10 @@ test_expect_success 'rename a remote renames repo remote.pushDefault' '
 '
 
 test_expect_success 'rename a remote renames repo remote.pushDefault but ignores global' '
+	test_config_global remote.pushDefault other &&
 	git clone one four.2 &&
 	(
 		cd four.2 &&
-		test_config_global remote.pushDefault other &&
 		git config remote.pushDefault origin &&
 		git remote rename origin upstream &&
 		test "$(git config --global remote.pushDefault)" = "other" &&
@@ -773,10 +773,10 @@ test_expect_success 'rename a remote renames repo remote.pushDefault but ignores
 '
 
 test_expect_success 'rename a remote renames repo remote.pushDefault but keeps global' '
+	test_config_global remote.pushDefault origin &&
 	git clone one four.3 &&
 	(
 		cd four.3 &&
-		test_config_global remote.pushDefault origin &&
 		git config remote.pushDefault origin &&
 		git remote rename origin upstream &&
 		test "$(git config --global remote.pushDefault)" = "origin" &&
@@ -823,10 +823,10 @@ test_expect_success 'rename succeeds with existing remote.<target>.prune' '
 '
 
 test_expect_success 'remove a remote' '
+	test_config_global remote.pushDefault origin &&
 	git clone one four.five &&
 	(
 		cd four.five &&
-		test_config_global remote.pushDefault origin &&
 		git config branch.master.pushRemote origin &&
 		git remote remove origin &&
 		test -z "$(git for-each-ref refs/remotes/origin)" &&
@@ -847,10 +847,10 @@ test_expect_success 'remove a remote removes repo remote.pushDefault' '
 '
 
 test_expect_success 'remove a remote removes repo remote.pushDefault but ignores global' '
+	test_config_global remote.pushDefault other &&
 	git clone one four.five.2 &&
 	(
 		cd four.five.2 &&
-		test_config_global remote.pushDefault other &&
 		git config remote.pushDefault origin &&
 		git remote remove origin &&
 		test "$(git config --global remote.pushDefault)" = "other" &&
@@ -859,10 +859,10 @@ test_expect_success 'remove a remote removes repo remote.pushDefault but ignores
 '
 
 test_expect_success 'remove a remote removes repo remote.pushDefault but keeps global' '
+	test_config_global remote.pushDefault origin &&
 	git clone one four.five.3 &&
 	(
 		cd four.five.3 &&
-		test_config_global remote.pushDefault origin &&
 		git config remote.pushDefault origin &&
 		git remote remove origin &&
 		test "$(git config --global remote.pushDefault)" = "origin" &&
Previous: Bert WesargNext: Bert Wesarg
Message 9 of 10 in “remote rename/remove: improve handling of configuration values”
  1. 0/7 remote rename/remove: improve handling of configuration valuesBert Wesarg, Jan 27, 2020
  2. 2/6 remote: clean-up by returning early to avoid one indentationBert Wesarg, Jan 27, 2020
  3. 1/6 pull --rebase/remote rename: document and honor single-letter abbreviations rebase typesBert Wesarg, Jan 27, 2020
  4. 3/6 remote: clean-up config callbackBert Wesarg, Jan 27, 2020
  5. 5/6 config: provide access to the current line numberBert Wesarg, Jan 27, 2020
  6. 4/6 remote rename/remove: handle branch.<name>.pushRemote config valuesBert Wesarg, Jan 27, 2020
  7. 6/6 remote rename/remove: gently handle remote.pushDefault configBert Wesarg, Jan 27, 2020
  8. 6/6 remote rename/remove: gently handle remote.pushDefault configBert Wesarg, Jan 27, 2020
  9. Junio C HamanoJan 29, 2020
  10. Bert WesargJan 29, 2020

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.