summaryrefslogtreecommitdiff
path: root/include/git2/common.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-03-18 14:19:35 -0700
committerRussell Belfer <rb@github.com>2013-03-18 14:19:35 -0700
commit41954a49c12a72eda3b3fe02c2752f6831b5dbf9 (patch)
tree4b9cff17fbd7172efddde4dba8e1d2f6b31e0c45 /include/git2/common.h
parent5540d9477ed143707435324e785336d254b12e47 (diff)
downloadlibgit2-41954a49c12a72eda3b3fe02c2752f6831b5dbf9.tar.gz
Switch search paths to classic delimited strings
This switches the APIs for setting and getting the global/system search paths from using git_strarray to using a simple string with GIT_PATH_LIST_SEPARATOR delimited paths, just as the environment PATH variable would contain. This makes it simpler to get and set the value. I also added code to expand "$PATH" when setting a new value to embed the old value of the path. This means that I no longer require separate actions to PREPEND to the value.
Diffstat (limited to 'include/git2/common.h')
-rw-r--r--include/git2/common.h33
1 files changed, 14 insertions, 19 deletions
diff --git a/include/git2/common.h b/include/git2/common.h
index 137ffa0a4..b8c3e42ce 100644
--- a/include/git2/common.h
+++ b/include/git2/common.h
@@ -131,7 +131,6 @@ enum {
GIT_OPT_SET_MWINDOW_MAPPED_LIMIT,
GIT_OPT_GET_SEARCH_PATH,
GIT_OPT_SET_SEARCH_PATH,
- GIT_OPT_PREPEND_SEARCH_PATH,
};
/**
@@ -152,25 +151,21 @@ enum {
* Set the maximum amount of memory that can be mapped at any time
* by the library
*
- * opts(GIT_OPT_GET_SEARCH_PATH, const git_strarray **, int level)
- * Get a strarray of 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 applies to shared attributes and ignore files, too.
+ * opts(GIT_OPT_GET_SEARCH_PATH, int level, char *out, size_t len)
+ * 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 up to size `len`. Returns GIT_EBUFS if buffer is too small.
*
- * opts(GIT_OPT_SET_SEARCH_PATH, int level, const git_strarray *)
- * Set the search path for a given level of config data. Passing
- * NULL for the git_strarray pointer resets the search path to the
- * default (which is generally based on environment variables).
- * "level" must be one of GIT_CONFIG_LEVEL_SYSTEM,
- * GIT_CONFIG_LEVEL_GLOBAL, or GIT_CONFIG_LEVEL_XDG. The search
- * path applies to shared attributes and ignore files, too.
- *
- * opts(GIT_OPT_PREPEND_SEARCH_PATH, int level, const git_strarray *)
- * Prepend new directories to 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 applies to shared attributes and ignore files, too.
+ * opts(GIT_OPT_SET_SEARCH_PATH, int level, const char *path)
+ * Set the search path for a level of config data. The search path
+ * applied to shared attributes and ignore files, too.
+ * - `path` lists directories delimited by GIT_PATH_LIST_SEPARATOR.
+ * Pass NULL to reset to the default (generally based on environment
+ * 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.
*
* @param option Option key
* @param ... value to set the option