summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0667fcf)
raw | patch | inline | side by side (parent: 0667fcf)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Sat, 16 Dec 2006 14:15:02 +0000 (15:15 +0100) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sat, 16 Dec 2006 21:38:44 +0000 (13:38 -0800) |
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>
be renamed, too.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
refs.c | patch | blob | history | |
t/t3200-branch.sh | patch | blob | history |
index a02957c399ded94bb9a49c9dc3d8ab5d9411bbec..d911b9e86009aa3d81c6c4d310a26bf057920e8a 100644 (file)
--- a/refs.c
+++ b/refs.c
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:
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index 5782c30b03a7e7bb7d244d305e13e856eed40a89..a6ea0f6a196c5285c229021c96bb83f33a3aa748 100755 (executable)
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
git-branch r &&
git-branch -m q r/q'
+git-repo-config branch.s/s.dummy Hello
+
test_expect_success \
'git branch -m s/s s should work when s/t is deleted' \
'git-branch -l s/s &&
git-branch -m s/s s &&
test -f .git/logs/refs/heads/s'
+test_expect_success 'config information was renamed, too' \
+ "test $(git-repo-config branch.s.dummy) = Hello &&
+ ! git-repo-config branch.s/s/dummy"
+
test_expect_failure \
'git-branch -m u v should fail when the reflog for u is a symlink' \
'git-branch -l u &&