Skip to content

Commit 0f1da60

Browse files
avargitster
authored andcommitted
remote: write camel-cased *.pushRemote on rename
When a remote is renamed don't change the canonical "*.pushRemote" form to "*.pushremote". Fixes and tests for a minor bug in 923d4a5 (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 b3fd6cb (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bfa9148 commit 0f1da60

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

builtin/remote.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ static int mv(int argc, const char **argv)
746746
}
747747
if (info->push_remote_name && !strcmp(info->push_remote_name, rename.old_name)) {
748748
strbuf_reset(&buf);
749-
strbuf_addf(&buf, "branch.%s.pushremote", item->string);
749+
strbuf_addf(&buf, "branch.%s.pushRemote", item->string);
750750
git_config_set(buf.buf, rename.new_name);
751751
}
752752
}

t/t5505-remote.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,7 @@ test_expect_success 'rename a remote' '
754754
cd four &&
755755
git config branch.main.pushRemote origin &&
756756
git remote rename origin upstream &&
757+
grep "pushRemote" .git/config &&
757758
test -z "$(git for-each-ref refs/remotes/origin)" &&
758759
test "$(git symbolic-ref refs/remotes/upstream/HEAD)" = "refs/remotes/upstream/main" &&
759760
test "$(git rev-parse upstream/main)" = "$(git rev-parse main)" &&
@@ -770,6 +771,7 @@ test_expect_success 'rename a remote renames repo remote.pushDefault' '
770771
cd four.1 &&
771772
git config remote.pushDefault origin &&
772773
git remote rename origin upstream &&
774+
grep pushDefault .git/config &&
773775
test "$(git config --local remote.pushDefault)" = "upstream"
774776
)
775777
'

0 commit comments

Comments
 (0)