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

Re: [PATCH 2/2] remote: write camel-cased *.pushRemote on rename

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 25, 2021, 03:17 UTC
Message-ID
<xmqqsg5kx2ci.fsf@gitster.g>
In-Reply-To
<20210225012117.17331-2-avarab@gmail.com>
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
Show 51 quoted lines
> When a remote is renamed don't change the canonical "*.pushRemote"
> form to "*.pushremote". Fixes and tests for a minor bug in
> 923d4a5ca4f (remote rename/remove: handle branch.<name>.pushRemote
> config values, 2020-01-27). See the preceding commit for why this does
> & doesn't matter.
>
> While we're at it let's also test that we handle the "*.pushDefault"
> key correctly. The code to handle that was added in
> b3fd6cbf294 (remote rename/remove: gently handle remote.pushDefault
> config, 2020-02-01) and does the right thing, but nothing tested that
> we wrote out the canonical camel-cased form.
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
>  builtin/remote.c  | 2 +-
>  t/t5505-remote.sh | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/builtin/remote.c b/builtin/remote.c
> index f286ae97538..717b662d455 100644
> --- a/builtin/remote.c
> +++ b/builtin/remote.c
> @@ -746,7 +746,7 @@ static int mv(int argc, const char **argv)
>  		}
>  		if (info->push_remote_name && !strcmp(info->push_remote_name, rename.old_name)) {
>  			strbuf_reset(&buf);
> -			strbuf_addf(&buf, "branch.%s.pushremote", item->string);
> +			strbuf_addf(&buf, "branch.%s.pushRemote", item->string);
>  			git_config_set(buf.buf, rename.new_name);
>  		}
>  	}
> diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
> index 2a7b5cd00a0..34fc3fa421f 100755
> --- a/t/t5505-remote.sh
> +++ b/t/t5505-remote.sh
> @@ -757,6 +757,7 @@ test_expect_success 'rename a remote' '
>  		cd four &&
>  		git config branch.main.pushRemote origin &&
>  		git remote rename origin upstream &&
> +		grep "pushRemote" .git/config &&
>  		test -z "$(git for-each-ref refs/remotes/origin)" &&
>  		test "$(git symbolic-ref refs/remotes/upstream/HEAD)" = "refs/remotes/upstream/main" &&
>  		test "$(git rev-parse upstream/main)" = "$(git rev-parse main)" &&
> @@ -773,6 +774,7 @@ test_expect_success 'rename a remote renames repo remote.pushDefault' '
>  		cd four.1 &&
>  		git config remote.pushDefault origin &&
>  		git remote rename origin upstream &&
> +		grep pushDefault .git/config &&
>  		test "$(git config --local remote.pushDefault)" = "upstream"
>  	)
>  '

Again, good find, but I am not sure if we want the test to be so strict. Besides, quoting one and not quoting the other in the same patch looks the test is also being inconsistent ;-).

Thanks.
Previous: Ævar Arnfjörð BjarmasonNext: Bert Wesarg
Message 3 of 8 in “remote: add camel-cased *.tagOpt key, like clone”
  1. 1/2 remote: add camel-cased *.tagOpt key, like cloneÆvar Arnfjörð Bjarmason, Feb 25, 2021
  2. 2/2 remote: write camel-cased *.pushRemote on renameÆvar Arnfjörð Bjarmason, Feb 25, 2021
  3. Junio C HamanoFeb 25, 2021
  4. Bert WesargMar 18, 2021
  5. Junio C HamanoFeb 25, 2021
  6. Junio C HamanoFeb 25, 2021
  7. Ævar Arnfjörð BjarmasonFeb 25, 2021
  8. Junio C HamanoFeb 25, 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.