summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e58db03)
raw | patch | inline | side by side (parent: e58db03)
author | Gerrit Pape <pape@smarden.org> | |
Sat, 9 Jun 2007 12:40:35 +0000 (12:40 +0000) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 9 Jun 2007 18:53:05 +0000 (11:53 -0700) |
When deleting branches, remove the sections referring to these branches
from the config file.
Signed-off-by: Gerrit Pape <pape@smarden.org>
from the config file.
Signed-off-by: Gerrit Pape <pape@smarden.org>
builtin-branch.c | patch | blob | history | |
t/t3200-branch.sh | patch | blob | history |
diff --git a/builtin-branch.c b/builtin-branch.c
index da480519d7a1e7fb51d94c393ded3fe64840ee8b..bd4748f845cbe8af63079d9f8a9b7222de44f9ee 100644 (file)
--- a/builtin-branch.c
+++ b/builtin-branch.c
unsigned char sha1[20];
char *name = NULL;
const char *fmt, *remote;
+ char section[PATH_MAX];
int i;
int ret = 0;
error("Error deleting %sbranch '%s'", remote,
argv[i]);
ret = 1;
- } else
+ } else {
printf("Deleted %sbranch %s.\n", remote, argv[i]);
-
+ snprintf(section, sizeof(section), "branch.%s",
+ argv[i]);
+ if (git_config_rename_section(section, NULL) < 0)
+ warning("Update of config-file failed");
+ }
}
if (name)
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index 6f6d8844e8628d006b1d4c11eb02a5ee14a8fd35..f1793d0b9ab6cf6e5c24abaf3aaa0892ea4f9631 100755 (executable)
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
test "$(git-config branch.my7.remote)" = local &&
test "$(git-config branch.my7.merge)" = refs/heads/o/o'
+test_expect_success 'test deleting branch deletes branch config' \
+ 'git-branch -d my7 &&
+ test "$(git-config branch.my7.remote)" = "" &&
+ test "$(git-config branch.my7.merge)" = ""'
+
+test_expect_success 'test deleting branch without config' \
+ 'git-branch my7 s &&
+ test "$(git-branch -d my7 2>&1)" = "Deleted branch my7."'
+
# Keep this test last, as it changes the current branch
cat >expect <<EOF
0000000000000000000000000000000000000000 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master