summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1e31fbe)
raw | patch | inline | side by side (parent: 1e31fbe)
author | Geert Bosch <bosch@gnat.com> | |
Thu, 5 Apr 2007 14:20:55 +0000 (10:20 -0400) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 5 Apr 2007 21:53:22 +0000 (14:53 -0700) |
Make git_config_rename_section return success if no config file
exists. Otherwise, renaming a branch would abort, leaving the
repository in an inconsistent state.
[jc: test]
Signed-off-by: Geert Bosch <bosch@gnat.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
exists. Otherwise, renaming a branch would abort, leaving the
repository in an inconsistent state.
[jc: test]
Signed-off-by: Geert Bosch <bosch@gnat.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
config.c | patch | blob | history | |
t/t3200-branch.sh | patch | blob | history |
diff --git a/config.c b/config.c
index 6479855723d6dc94fa7c440868724a794bb59901..70d105567921fe75518d8d5fe3d3df4aad0659cd 100644 (file)
--- a/config.c
+++ b/config.c
}
if (!(config_file = fopen(config_filename, "rb"))) {
- ret = error("Could not open config file!");
- goto out;
+ /* no config file means nothing to rename, no error */
+ goto unlock_and_out;
}
while (fgets(buf, sizeof(buf), config_file)) {
}
}
fclose(config_file);
+ unlock_and_out:
if (close(out_fd) || commit_lock_file(lock) < 0)
ret = error("Cannot commit config file!");
out:
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index 9558bdb6318cc2956c43153084e1f1cc8386973f..ce2c5f41fd55e15bec4e42d9dbba0d310a6e6c87 100755 (executable)
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
git-branch r &&
git-branch -m q r/q'
+mv .git/config .git/config-saved
+
+test_expect_success 'git branch -m q Q without config should succeed' '
+ git-branch -m q Q &&
+ git-branch -m Q q
+'
+
+mv .git/config-saved .git/config
+
git-config branch.s/s.dummy Hello
test_expect_success \