From cb626bc6300c988d066aacc53a3f5893ee5dba53 Mon Sep 17 00:00:00 2001 From: Dennis Stosberg Date: Mon, 2 Oct 2006 19:23:53 +0200 Subject: [PATCH] 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 Signed-off-by: Junio C Hamano --- refs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/refs.c b/refs.c index 5e653141ce..98327d7983 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 -- 2.11.4.GIT