]> git.ipfire.org Git - thirdparty/git.git/commitdiff
attr: warn on inaccessible attribute files
authorJeff King <peff@peff.net>
Tue, 21 Aug 2012 06:31:52 +0000 (02:31 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 21 Aug 2012 21:47:07 +0000 (14:47 -0700)
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>
attr.c

diff --git a/attr.c b/attr.c
index b52efb55a036be10618d531d66697d7f7220c524..cab01b8b57bd4bfa41d59ca344f9e8cf462cfcc3 100644 (file)
--- 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);