summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a9cb3c6)
raw | patch | inline | side by side (parent: a9cb3c6)
author | Junio C Hamano <junkio@cox.net> | |
Thu, 19 Oct 2006 08:28:47 +0000 (01:28 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 19 Oct 2006 08:28:47 +0000 (01:28 -0700) |
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>
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>
refs.c | patch | blob | history | |
t/t3210-pack-refs.sh | patch | blob | history |
index 3d100df85c4ca9f2f54c22a5c771014a8ba10f38..ed2e3b16a7c843d75da361011b36c74d51f629b8 100644 (file)
--- a/refs.c
+++ b/refs.c
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);
diff --git a/t/t3210-pack-refs.sh b/t/t3210-pack-refs.sh
index a4fbfda467602a196c4e39c099720f540ae76cd1..b1e9f2eed22b9938a6dbba89a98f6dcc9f2dded1 100755 (executable)
--- a/t/t3210-pack-refs.sh
+++ b/t/t3210-pack-refs.sh
'
. ./test-lib.sh
+echo '[core] logallrefupdates = true' >>.git/config
+
test_expect_success \
'prepare a trivial repository' \
'echo Hello > A &&