From 7c9f5bec5182eb587fbc1094f2235d2babb70ad9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Sat, 17 Aug 2013 07:11:31 +0200 Subject: futils: return GIT_ENOTFOUND when trying to read a directory This lets the reference code return not-found when the user asks to look up a reference when in fact they pass a namespace. --- src/fileops.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/fileops.c') diff --git a/src/fileops.c b/src/fileops.c index 3a5a53074..210f45fa1 100644 --- a/src/fileops.c +++ b/src/fileops.c @@ -165,7 +165,13 @@ int git_futils_readbuffer_updated( return -1; } - if (S_ISDIR(st.st_mode) || !git__is_sizet(st.st_size+1)) { + + if (S_ISDIR(st.st_mode)) { + giterr_set(GITERR_INVALID, "requested file is a directory"); + return GIT_ENOTFOUND; + } + + if (!git__is_sizet(st.st_size+1)) { giterr_set(GITERR_OS, "Invalid regular file stat for '%s'", path); return -1; } -- cgit v1.2.3