Merge branch 'maint'
[gitweb.git] / dir.c
diff --git a/dir.c b/dir.c
index ee8e7115a8a37ca5c096dc3548b13e3761e4cac5..5a83aa7897f270279c403778f43aea6db1efc5af 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -424,6 +424,8 @@ int add_excludes_from_file_to_list(const char *fname,
 
        fd = open(fname, O_RDONLY);
        if (fd < 0 || fstat(fd, &st) < 0) {
+               if (errno != ENOENT)
+                       warn_on_inaccessible(fname);
                if (0 <= fd)
                        close(fd);
                if (!check_index ||
@@ -1363,12 +1365,17 @@ int remove_dir_recursively(struct strbuf *path, int flag)
 void setup_standard_excludes(struct dir_struct *dir)
 {
        const char *path;
+       char *xdg_path;
 
        dir->exclude_per_dir = ".gitignore";
        path = git_path("info/exclude");
-       if (!access(path, R_OK))
+       if (!excludes_file) {
+               home_config_paths(NULL, &xdg_path, "ignore");
+               excludes_file = xdg_path;
+       }
+       if (!access_or_warn(path, R_OK))
                add_excludes_from_file(dir, path);
-       if (excludes_file && !access(excludes_file, R_OK))
+       if (excludes_file && !access_or_warn(excludes_file, R_OK))
                add_excludes_from_file(dir, excludes_file);
 }