summaryrefslogtreecommitdiff
path: root/refs
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2016-05-05 12:09:41 (GMT)
committerMichael Haggerty <mhagger@alum.mit.edu>2016-05-05 14:37:04 (GMT)
commite167a5673e25b960dce118fb967d54da30b69def (patch)
treeb3c53b071f76ae1c3c50fd49b531a644b06572e9 /refs
parent5387c0d8839e366c44838c808ccc20eb7f9bd358 (diff)
downloadgit-e167a5673e25b960dce118fb967d54da30b69def.zip
git-e167a5673e25b960dce118fb967d54da30b69def.tar.gz
git-e167a5673e25b960dce118fb967d54da30b69def.tar.bz2
read_raw_ref(): don't get confused by an empty directory
Even if there is an empty directory where we look for the loose version of a reference, check for a packed reference before giving up. This fixes the failing test that was introduced two commits ago. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Diffstat (limited to 'refs')
-rw-r--r--refs/files-backend.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c
index ad9cd86..0cc116d 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -1477,7 +1477,16 @@ stat_ref:
/* Is it a directory? */
if (S_ISDIR(st.st_mode)) {
- errno = EISDIR;
+ /*
+ * Even though there is a directory where the loose
+ * ref is supposed to be, there could still be a
+ * packed ref:
+ */
+ if (resolve_missing_loose_ref(refname, sha1, flags)) {
+ errno = EISDIR;
+ goto out;
+ }
+ ret = 0;
goto out;
}