aboutsummaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-10-19 01:28:47 -0700
committerJunio C Hamano <junkio@cox.net>2006-10-19 01:28:47 -0700
commit3b463c3f02f83ef0bce2d5daa193459418e5258f (patch)
treeb9be594d708d5a343deece2f9f572f852e40bab7 /refs.c
parenta9cb3c6ecb97c4734423045f47899e03f135d3bd (diff)
downloadgit-3b463c3f02f83ef0bce2d5daa193459418e5258f.tar.gz
git-3b463c3f02f83ef0bce2d5daa193459418e5258f.tar.xz
ref-log: fix D/F conflict coming from deleted refs.
After deleting a branch l/k, you should be able to create a branch l. Earlier we added remove_empty_directories() on the ref creation side to remove leftover .git/refs/l directory but we also need a matching code to remove .git/logs/refs/l directory. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/refs.c b/refs.c
index 3d100df85..ed2e3b16a 100644
--- a/refs.c
+++ b/refs.c
@@ -733,8 +733,18 @@ static int log_ref_write(struct ref_lock *lock,
if (logfd < 0) {
if (!(oflags & O_CREAT) && errno == ENOENT)
return 0;
- return error("Unable to append to %s: %s",
- lock->log_file, strerror(errno));
+
+ if ((oflags & O_CREAT) && errno == EISDIR) {
+ if (remove_empty_directories(lock->log_file)) {
+ return error("There are still logs under '%s'",
+ lock->log_file);
+ }
+ logfd = open(lock->log_file, oflags, 0666);
+ }
+
+ if (logfd < 0)
+ return error("Unable to append to %s: %s",
+ lock->log_file, strerror(errno));
}
committer = git_committer_info(1);