1
0
mirror of https://github.com/git/git.git synced 2024-09-30 05:32:08 +02:00

lock_ref_sha1_basic does not remove empty directories on BSD

lock_ref_sha1_basic relies on errno beeing set to EISDIR by the
call to read() in resolve_ref() to detect directories.  But calling
read() on a directory under NetBSD returns EPERM, and even succeeds
for local filesystems on FreeBSD.

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Dennis Stosberg 2006-10-02 19:23:53 +02:00 committed by Junio C Hamano
parent f5961572a0
commit 7a21632fa3

6
refs.c

@ -42,6 +42,12 @@ const char *resolve_ref(const char *path, unsigned char *sha1, int reading)
}
}
/* Is it a directory? */
if (S_ISDIR(st.st_mode)) {
errno = EISDIR;
return NULL;
}
/*
* Anything else, just open it and try to use it as
* a ref