]> git.ipfire.org Git - thirdparty/git.git/commitdiff
remote: write camel-cased *.pushRemote on rename
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Thu, 25 Feb 2021 01:21:17 +0000 (02:21 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 25 Feb 2021 03:03:00 +0000 (19:03 -0800)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/remote.c
t/t5505-remote.sh

index f286ae9753800658d32d7bd609e5584e8505b745..717b662d4554f73621a9e173c18e78b189d45165 100644 (file)
@@ -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);
                }
        }
index ffd821c00e3dd933da11a8742d215b627a4c20e7..421ac8629b30bc6d9c0d6c3a2dd0e103dd119f1a 100755 (executable)
@@ -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"
        )
 '