Skip to content

Commit

Permalink
lock_ref_sha1_basic does not remove empty directories on BSD
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dennis Stosberg authored and Junio C Hamano committed Oct 3, 2006
1 parent f596157 commit cb626bc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions refs.c
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit cb626bc

Please sign in to comment.