diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-07-09 16:00:35 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-07-09 16:00:36 (GMT) |
commit | d02d7ac303b1a22c7de4a6c3a00074d38b498134 (patch) | |
tree | 00bb203b30a44c8e389119694f722a5d09bcda49 /attr.c | |
parent | 8228a23b35f6bd34a87d4d839d06e7c18ae9e750 (diff) | |
parent | 0e8593dc5b812df00400347e88f5707225fe831e (diff) | |
download | git-d02d7ac303b1a22c7de4a6c3a00074d38b498134.zip git-d02d7ac303b1a22c7de4a6c3a00074d38b498134.tar.gz git-d02d7ac303b1a22c7de4a6c3a00074d38b498134.tar.bz2 |
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 'attr.c')
-rw-r--r-- | attr.c | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -497,6 +497,7 @@ static int git_attr_system(void) static void bootstrap_attr_stack(void) { struct attr_stack *elem; + char *xdg_attributes_file; if (attr_stack) return; @@ -515,13 +516,15 @@ static void bootstrap_attr_stack(void) } } - 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 (!git_attributes_file) { + 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 (!is_bare_repository() || direction == GIT_ATTR_INDEX) { |