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>
This commit is contained in:
parent
6966073102
commit
11e50b2736
5
attr.c
5
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);
|
||||
|
Loading…
Reference in New Issue
Block a user