From dc81c58cd6b791a3db23f1d1acb5f7d38d1ff086 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sat, 16 Dec 2006 15:15:02 +0100 Subject: git-branch: rename config vars branch..*, too When renaming a branch, the corresponding config section should be renamed, too. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- refs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'refs.c') diff --git a/refs.c b/refs.c index a02957c39..d911b9e86 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: -- cgit v1.2.1