aboutsummaryrefslogtreecommitdiff
path: root/attr.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2012-08-21 02:31:52 -0400
committerJunio C Hamano <gitster@pobox.com>2012-08-21 14:47:07 -0700
commit11e50b2736f374f1608e0c5690405be1a74aa16d (patch)
tree2c923bca5acd02162d066d17b19a5d430e0e0b09 /attr.c
parent6966073102170171da4c25a4038bbd143fa6a75b (diff)
downloadgit-11e50b2736f374f1608e0c5690405be1a74aa16d.tar.gz
git-11e50b2736f374f1608e0c5690405be1a74aa16d.tar.xz
attr: warn on inaccessible attribute files
Just like config and gitignore files, we silently ignore missing or inaccessible attribute files. An existent but inaccessible file is probably a configuration error, so let's warn the user. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'attr.c')
-rw-r--r--attr.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/attr.c b/attr.c
index b52efb55a..cab01b8b5 100644
--- a/attr.c
+++ b/attr.c
@@ -352,8 +352,11 @@ static struct attr_stack *read_attr_from_file(const char *path, int macro_ok)
char buf[2048];
int lineno = 0;
- if (!fp)
+ if (!fp) {
+ if (errno != ENOENT)
+ warning(_("unable to access '%s': %s"), path, strerror(errno));
return NULL;
+ }
res = xcalloc(1, sizeof(*res));
while (fgets(buf, sizeof(buf), fp))
handle_attr_line(res, buf, path, ++lineno, macro_ok);