aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Stosberg <dennis@stosberg.net>2006-10-02 19:23:53 +0200
committerJunio C Hamano <junkio@cox.net>2006-10-03 01:02:27 -0700
commitcb626bc6300c988d066aacc53a3f5893ee5dba53 (patch)
treecbe93652257036afd5ce59052c6e76cbe7430a8a
parentf5961572a02ef08324f297fe93b704ff2137e5a6 (diff)
downloadgit-cb626bc6300c988d066aacc53a3f5893ee5dba53.tar.gz
git-cb626bc6300c988d066aacc53a3f5893ee5dba53.tar.xz
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>
-rw-r--r--refs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/refs.c b/refs.c
index 5e653141c..98327d798 100644
--- a/refs.c
+++ b/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