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>
This commit is contained in:
parent
a9cb3c6ecb
commit
3b463c3f02
10
refs.c
10
refs.c
@ -733,6 +733,16 @@ static int log_ref_write(struct ref_lock *lock,
|
|||||||
if (logfd < 0) {
|
if (logfd < 0) {
|
||||||
if (!(oflags & O_CREAT) && errno == ENOENT)
|
if (!(oflags & O_CREAT) && errno == ENOENT)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
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",
|
return error("Unable to append to %s: %s",
|
||||||
lock->log_file, strerror(errno));
|
lock->log_file, strerror(errno));
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,8 @@ semantic is still the same.
|
|||||||
'
|
'
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
|
echo '[core] logallrefupdates = true' >>.git/config
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'prepare a trivial repository' \
|
'prepare a trivial repository' \
|
||||||
'echo Hello > A &&
|
'echo Hello > A &&
|
||||||
|
Loading…
Reference in New Issue
Block a user