summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2006-12-16 14:15:02 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-12-16 21:38:44 (GMT)
commitdc81c58cd6b791a3db23f1d1acb5f7d38d1ff086 (patch)
tree73800b0919ca419f455d1293e0a30a2db954f900 /refs.c
parent0667fcfb6271e9e1ea032a0e3a7d74c9d6a5fa8a (diff)
downloadgit-dc81c58cd6b791a3db23f1d1acb5f7d38d1ff086.zip
git-dc81c58cd6b791a3db23f1d1acb5f7d38d1ff086.tar.gz
git-dc81c58cd6b791a3db23f1d1acb5f7d38d1ff086.tar.bz2
git-branch: rename config vars branch.<branch>.*, too
When renaming a branch, the corresponding config section should be renamed, too. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/refs.c b/refs.c
index a02957c..d911b9e 100644
--- a/refs.c
+++ b/refs.c
@@ -867,6 +867,16 @@ int rename_ref(const char *oldref, const char *newref, const char *logmsg)
goto rollback;
}
+ if (!strncmp(oldref, "refs/heads/", 11) &&
+ !strncmp(newref, "refs/heads/", 11)) {
+ char oldsection[1024], newsection[1024];
+
+ snprintf(oldsection, 1024, "branch.%s", oldref + 11);
+ snprintf(newsection, 1024, "branch.%s", newref + 11);
+ if (git_config_rename_section(oldsection, newsection) < 0)
+ return 1;
+ }
+
return 0;
rollback: