diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-07-05 02:08:18 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-07-05 02:08:18 +0300 |
commit | 89d62d5e8ef42be3a73493e8ffbede589c7a31d1 (patch) | |
tree | 4ff0c976caa1bdc13f9d9e3030055dc40695338b /attr.c | |
parent | 812907d16fb46181d6eb17309dde697edfd06add (diff) | |
parent | ed773a18c6e92ae4f4e016f4529d6bdfbbbd56d8 (diff) |
Merge branch 'bc/more-git-var'
Add more "git var" for toolsmiths to learn various locations Git is
configured with either via the configuration or hardcoded defaults.
* bc/more-git-var:
var: add config file locations
var: add attributes files locations
attr: expose and rename accessor functions
var: adjust memory allocation for strings
var: format variable structure with C99 initializers
var: add support for listing the shell
t: add a function to check executable bit
var: mark unused parameters in git_var callbacks
Diffstat (limited to 'attr.c')
-rw-r--r-- | attr.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -872,7 +872,7 @@ static struct attr_stack *read_attr(struct index_state *istate, return res; } -static const char *git_etc_gitattributes(void) +const char *git_attr_system_file(void) { static const char *system_wide; if (!system_wide) @@ -880,7 +880,7 @@ static const char *git_etc_gitattributes(void) return system_wide; } -static const char *get_home_gitattributes(void) +const char *git_attr_global_file(void) { if (!git_attributes_file) git_attributes_file = xdg_config_home("attributes"); @@ -888,7 +888,7 @@ static const char *get_home_gitattributes(void) return git_attributes_file; } -static int git_attr_system(void) +int git_attr_system_is_enabled(void) { return !git_env_bool("GIT_ATTR_NOSYSTEM", 0); } @@ -922,14 +922,14 @@ static void bootstrap_attr_stack(struct index_state *istate, push_stack(stack, e, NULL, 0); /* system-wide frame */ - if (git_attr_system()) { - e = read_attr_from_file(git_etc_gitattributes(), flags); + if (git_attr_system_is_enabled()) { + e = read_attr_from_file(git_attr_system_file(), flags); push_stack(stack, e, NULL, 0); } /* home directory */ - if (get_home_gitattributes()) { - e = read_attr_from_file(get_home_gitattributes(), flags); + if (git_attr_global_file()) { + e = read_attr_from_file(git_attr_global_file(), flags); push_stack(stack, e, NULL, 0); } |