summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-07-09 09:00:35 -0700
committerJunio C Hamano <gitster@pobox.com>2012-07-09 09:00:36 -0700
commitd02d7ac303b1a22c7de4a6c3a00074d38b498134 (patch)
tree00bb203b30a44c8e389119694f722a5d09bcda49 /dir.c
parent8228a23b35f6bd34a87d4d839d06e7c18ae9e750 (diff)
parent0e8593dc5b812df00400347e88f5707225fe831e (diff)
downloadgit-d02d7ac303b1a22c7de4a6c3a00074d38b498134.tar.gz
Merge branch 'mm/config-xdg'
Teach git to read various information from $XDG_CONFIG_HOME/git/ to allow the user to avoid cluttering $HOME. * mm/config-xdg: config: write to $XDG_CONFIG_HOME/git/config file when appropriate Let core.attributesfile default to $XDG_CONFIG_HOME/git/attributes Let core.excludesfile default to $XDG_CONFIG_HOME/git/ignore config: read (but not write) from $XDG_CONFIG_HOME/git/config file
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/dir.c b/dir.c
index 0015cc54f4..a772c6dc6c 100644
--- a/dir.c
+++ b/dir.c
@@ -1303,12 +1303,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 (!excludes_file) {
+ home_config_paths(NULL, &xdg_path, "ignore");
+ excludes_file = xdg_path;
+ }
if (!access(path, R_OK))
add_excludes_from_file(dir, path);
- if (excludes_file && !access(excludes_file, R_OK))
+ if (!access(excludes_file, R_OK))
add_excludes_from_file(dir, excludes_file);
}