diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2015-11-16 23:31:19 -0500 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2015-11-16 23:31:19 -0500 |
commit | 3eac1037d68a355f77787d7c8e496694715dd28c (patch) | |
tree | 419bf46018cbc5ba91737fa010d52efd6fc59b1d | |
parent | 32b9e647c5a91bb2cfb42822d86962054cfeeeea (diff) | |
download | libgit2-3eac1037d68a355f77787d7c8e496694715dd28c.tar.gz |
settings: allow users to set PROGRAMDATA
Allow users to set the `git_libgit2_opts` search path for the
`GIT_CONFIG_LEVEL_PROGRAMDATA`. Convert `GIT_CONFIG_LEVEL_PROGRAMDATA`
to `GIT_SYSDIR_PROGRAMDATA` for setting the configuration.
-rw-r--r-- | include/git2/common.h | 11 | ||||
-rw-r--r-- | src/settings.c | 15 |
2 files changed, 18 insertions, 8 deletions
diff --git a/include/git2/common.h b/include/git2/common.h index e687977d5..ee230dfae 100644 --- a/include/git2/common.h +++ b/include/git2/common.h @@ -174,9 +174,9 @@ typedef enum { * * opts(GIT_OPT_GET_SEARCH_PATH, int level, git_buf *buf) * * > Get the search path for a given level of config data. "level" must - * > be one of `GIT_CONFIG_LEVEL_SYSTEM`, `GIT_CONFIG_LEVEL_GLOBAL`, or - * > `GIT_CONFIG_LEVEL_XDG`. The search path is written to the `out` - * > buffer. + * > be one of `GIT_CONFIG_LEVEL_SYSTEM`, `GIT_CONFIG_LEVEL_GLOBAL`, + * > `GIT_CONFIG_LEVEL_XDG`, or `GIT_CONFIG_LEVEL_PROGRAMDATA`. + * > The search path is written to the `out` buffer. * * * opts(GIT_OPT_SET_SEARCH_PATH, int level, const char *path) * @@ -188,8 +188,9 @@ typedef enum { * > variables). Use magic path `$PATH` to include the old value * > of the path (if you want to prepend or append, for instance). * > - * > - `level` must be GIT_CONFIG_LEVEL_SYSTEM, GIT_CONFIG_LEVEL_GLOBAL, - * > or GIT_CONFIG_LEVEL_XDG. + * > - `level` must be `GIT_CONFIG_LEVEL_SYSTEM`, + * > `GIT_CONFIG_LEVEL_GLOBAL`, `GIT_CONFIG_LEVEL_XDG`, or + * > `GIT_CONFIG_LEVEL_PROGRAMDATA`. * * * opts(GIT_OPT_SET_CACHE_OBJECT_LIMIT, git_otype type, size_t size) * diff --git a/src/settings.c b/src/settings.c index 91bdfd520..da99b59e2 100644 --- a/src/settings.c +++ b/src/settings.c @@ -49,9 +49,18 @@ static int config_level_to_sysdir(int config_level) int val = -1; switch (config_level) { - case GIT_CONFIG_LEVEL_SYSTEM: val = GIT_SYSDIR_SYSTEM; break; - case GIT_CONFIG_LEVEL_XDG: val = GIT_SYSDIR_XDG; break; - case GIT_CONFIG_LEVEL_GLOBAL: val = GIT_SYSDIR_GLOBAL; break; + case GIT_CONFIG_LEVEL_SYSTEM: + val = GIT_SYSDIR_SYSTEM; + break; + case GIT_CONFIG_LEVEL_XDG: + val = GIT_SYSDIR_XDG; + break; + case GIT_CONFIG_LEVEL_GLOBAL: + val = GIT_SYSDIR_GLOBAL; + break; + case GIT_CONFIG_LEVEL_PROGRAMDATA: + val = GIT_SYSDIR_PROGRAMDATA; + break; default: giterr_set( GITERR_INVALID, "Invalid config path selector %d", config_level); |