Commit 3eac1037 by Edward Thomson

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.
parent 32b9e647
......@@ -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)
*
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment