Start preparing for 1.7.12.3
[git.git] / attr.c
diff --git a/attr.c b/attr.c
index aef93d896f7e72ec534c0c2c576e418bedc5cb30..056d702f6e244e4188abc3c8dc4db647699ec4d1 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 && errno != ENOTDIR)
+                       warn_on_inaccessible(path);
                return NULL;
+       }
        res = xcalloc(1, sizeof(*res));
        while (fgets(buf, sizeof(buf), fp))
                handle_attr_line(res, buf, path, ++lineno, macro_ok);
@@ -520,11 +523,13 @@ static void bootstrap_attr_stack(void)
                home_config_paths(NULL, &xdg_attributes_file, "attributes");
                git_attributes_file = xdg_attributes_file;
        }
-       elem = read_attr_from_file(git_attributes_file, 1);
-       if (elem) {
-               elem->origin = NULL;
-               elem->prev = attr_stack;
-               attr_stack = elem;
+       if (git_attributes_file) {
+               elem = read_attr_from_file(git_attributes_file, 1);
+               if (elem) {
+                       elem->origin = NULL;
+                       elem->prev = attr_stack;
+                       attr_stack = elem;
+               }
        }
 
        if (!is_bare_repository() || direction == GIT_ATTR_INDEX) {