Code

Introduce git_etc_gitconfig() that encapsulates access of ETC_GITCONFIG.
[git.git] / dir.c
diff --git a/dir.c b/dir.c
index 01790ab27d25f63ea9f0816668a822d8f059664a..fa9f9021eafef09ddeaf61f21d577b7c53fa346a 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -778,3 +778,15 @@ int remove_dir_recursively(struct strbuf *path, int only_empty)
                ret = rmdir(path->buf);
        return ret;
 }
+
+void setup_standard_excludes(struct dir_struct *dir)
+{
+       const char *path;
+
+       dir->exclude_per_dir = ".gitignore";
+       path = git_path("info/exclude");
+       if (!access(path, R_OK))
+               add_excludes_from_file(dir, path);
+       if (excludes_file && !access(excludes_file, R_OK))
+               add_excludes_from_file(dir, excludes_file);
+}