From 0f1da600e6864e8b4fe97aea72a3b68c227a709c Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 25 Feb 2021 02:21:17 +0100 Subject: [PATCH] remote: write camel-cased *.pushRemote on rename MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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..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 Signed-off-by: Junio C Hamano --- 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 f286ae9753..717b662d45 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 ffd821c00e..421ac8629b 100755 --- a/t/t5505-remote.sh +++ b/t/t5505-remote.sh @@ -754,6 +754,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)" && @@ -770,6 +771,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" ) ' -- 2.39.5