{"thread":{"id":"43697","subject":"[PATCH 2/2] git-branch: rename config vars branch.<branch>.*, too","startedAt":"2006-12-16T14:15:02Z","lastAt":"2006-12-16T14:15:02Z","messageCount":1,"participants":["Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"296814","messageId":"Pine.LNX.4.63.0612161514280.3635@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"43697","inReplyTo":null,"subject":"[PATCH 2/2] git-branch: rename config vars branch.<branch>.*, too","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-12-16T14:15:02Z","receivedAt":"2006-12-16T14:15:02Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nWhen renaming a branch, the corresponding config section should\nbe renamed, too.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n refs.c            |   10 ++++++++++\n t/t3200-branch.sh |    6 ++++++\n 2 files changed, 16 insertions(+), 0 deletions(-)\n\ndiff --git a/refs.c b/refs.c\nindex a02957c..d911b9e 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -867,6 +867,16 @@ int rename_ref(const char *oldref, const char *newref, const char *logmsg)\n \t\tgoto rollback;\n \t}\n \n+\tif (!strncmp(oldref, \"refs/heads/\", 11) &&\n+\t\t\t!strncmp(newref, \"refs/heads/\", 11)) {\n+\t\tchar oldsection[1024], newsection[1024];\n+\n+\t\tsnprintf(oldsection, 1024, \"branch.%s\", oldref + 11);\n+\t\tsnprintf(newsection, 1024, \"branch.%s\", newref + 11);\n+\t\tif (git_config_rename_section(oldsection, newsection) < 0)\n+\t\t\treturn 1;\n+\t}\n+\n \treturn 0;\n \n  rollback:\ndiff --git a/t/t3200-branch.sh b/t/t3200-branch.sh\nindex 5782c30..a6ea0f6 100755\n--- a/t/t3200-branch.sh\n+++ b/t/t3200-branch.sh\n@@ -94,6 +94,8 @@ test_expect_failure \\\n          git-branch r &&\n          git-branch -m q r/q'\n \n+git-repo-config branch.s/s.dummy Hello\n+\n test_expect_success \\\n     'git branch -m s/s s should work when s/t is deleted' \\\n        'git-branch -l s/s &&\n@@ -104,6 +106,10 @@ test_expect_success \\\n         git-branch -m s/s s &&\n         test -f .git/logs/refs/heads/s'\n \n+test_expect_success 'config information was renamed, too' \\\n+\t\"test $(git-repo-config branch.s.dummy) = Hello &&\n+\t ! git-repo-config branch.s/s/dummy\"\n+\n test_expect_failure \\\n     'git-branch -m u v should fail when the reflog for u is a symlink' \\\n     'git-branch -l u &&\n-- \n1.4.4.1.g0604-dirty\n"}]}