Skip to content

Commit 11e50b2

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6966073 commit 11e50b2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

attr.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,11 @@ static struct attr_stack *read_attr_from_file(const char *path, int macro_ok)
352352
char buf[2048];
353353
int lineno = 0;
354354

355-
if (!fp)
355+
if (!fp) {
356+
if (errno != ENOENT)
357+
warning(_("unable to access '%s': %s"), path, strerror(errno));
356358
return NULL;
359+
}
357360
res = xcalloc(1, sizeof(*res));
358361
while (fgets(buf, sizeof(buf), fp))
359362
handle_attr_line(res, buf, path, ++lineno, macro_ok);

0 commit comments

Comments
 (0)