Skip to content

Commit

Permalink
attr: warn on inaccessible attribute files
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Aug 21, 2012
1 parent 6966073 commit 11e50b2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 11e50b2

Please sign in to comment.