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>
This commit is contained in:
Johannes Schindelin
2006-12-16 15:15:02 +01:00
committed by Junio C Hamano
parent 0667fcfb62
commit dc81c58cd6
2 changed files with 16 additions and 0 deletions

10
refs.c
View File

@ -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: