diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2015-10-20 17:42:42 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-10-21 15:11:18 +0200 |
commit | 8c7c5fa585c6a63dc8186febd6e032880655e85e (patch) | |
tree | 4fcfb2caf1ef82127605f03b2073ac4e75a561c8 /src/config.c | |
parent | 4280fabb9f79df6c4d95b1f08b97a03874b167eb (diff) | |
download | libgit2-cmn/programdata-config.tar.gz |
config: add a ProgramData levelcmn/programdata-config
This is where portable git stores the global configuration which we can
use to adhere to it even though git isn't quite installed on the system.
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c index f0b2c3a61..f4d4cb2b9 100644 --- a/src/config.c +++ b/src/config.c @@ -1086,6 +1086,12 @@ int git_config_find_system(git_buf *path) return git_sysdir_find_system_file(path, GIT_CONFIG_FILENAME_SYSTEM); } +int git_config_find_programdata(git_buf *path) +{ + git_buf_sanitize(path); + return git_sysdir_find_programdata_file(path, GIT_CONFIG_FILENAME_PROGRAMDATA); +} + int git_config__global_location(git_buf *buf) { const git_buf *paths; @@ -1133,6 +1139,10 @@ int git_config_open_default(git_config **out) error = git_config_add_file_ondisk(cfg, buf.ptr, GIT_CONFIG_LEVEL_SYSTEM, 0); + if (!error && !git_config_find_programdata(&buf)) + error = git_config_add_file_ondisk(cfg, buf.ptr, + GIT_CONFIG_LEVEL_PROGRAMDATA, 0); + git_buf_free(&buf); if (error) { |