git-tar-tree: don't RUN_SETUP
[gitweb.git] / refs.c
diff --git a/refs.c b/refs.c
index 5e653141ceb8183cfb7922c3ad89fd1a0110647a..98327d798375d2bc966f877af227a03070ce5d1b 100644 (file)
--- 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