Unverified Commit 358cc2e2 by Edward Thomson Committed by GitHub

Merge pull request #4396 from libgit2/cmn/config-regex-is-normalised

config: specify how we match the regular expressions
parents d11c4a1a 2f89bd90
...@@ -401,6 +401,10 @@ GIT_EXTERN(int) git_config_get_string_buf(git_buf *out, const git_config *cfg, c ...@@ -401,6 +401,10 @@ GIT_EXTERN(int) git_config_get_string_buf(git_buf *out, const git_config *cfg, c
* *
* The callback will be called on each variable found * The callback will be called on each variable found
* *
* The regular expression is applied case-sensitively on the normalized form of
* the variable name: the section and variable parts are lower-cased. The
* subsection is left unchanged.
*
* @param cfg where to look for the variable * @param cfg where to look for the variable
* @param name the variable's name * @param name the variable's name
* @param regexp regular expression to filter which variables we're * @param regexp regular expression to filter which variables we're
...@@ -413,6 +417,10 @@ GIT_EXTERN(int) git_config_get_multivar_foreach(const git_config *cfg, const cha ...@@ -413,6 +417,10 @@ GIT_EXTERN(int) git_config_get_multivar_foreach(const git_config *cfg, const cha
/** /**
* Get each value of a multivar * Get each value of a multivar
* *
* The regular expression is applied case-sensitively on the normalized form of
* the variable name: the section and variable parts are lower-cased. The
* subsection is left unchanged.
*
* @param out pointer to store the iterator * @param out pointer to store the iterator
* @param cfg where to look for the variable * @param cfg where to look for the variable
* @param name the variable's name * @param name the variable's name
...@@ -490,6 +498,8 @@ GIT_EXTERN(int) git_config_set_string(git_config *cfg, const char *name, const c ...@@ -490,6 +498,8 @@ GIT_EXTERN(int) git_config_set_string(git_config *cfg, const char *name, const c
/** /**
* Set a multivar in the local config file. * Set a multivar in the local config file.
* *
* The regular expression is applied case-sensitively on the value.
*
* @param cfg where to look for the variable * @param cfg where to look for the variable
* @param name the variable's name * @param name the variable's name
* @param regexp a regular expression to indicate which values to replace * @param regexp a regular expression to indicate which values to replace
...@@ -509,6 +519,8 @@ GIT_EXTERN(int) git_config_delete_entry(git_config *cfg, const char *name); ...@@ -509,6 +519,8 @@ GIT_EXTERN(int) git_config_delete_entry(git_config *cfg, const char *name);
/** /**
* Deletes one or several entries from a multivar in the local config file. * Deletes one or several entries from a multivar in the local config file.
* *
* The regular expression is applied case-sensitively on the value.
*
* @param cfg where to look for the variables * @param cfg where to look for the variables
* @param name the variable's name * @param name the variable's name
* @param regexp a regular expression to indicate which values to delete * @param regexp a regular expression to indicate which values to delete
...@@ -555,6 +567,10 @@ GIT_EXTERN(int) git_config_iterator_new(git_config_iterator **out, const git_con ...@@ -555,6 +567,10 @@ GIT_EXTERN(int) git_config_iterator_new(git_config_iterator **out, const git_con
* Use `git_config_next` to advance the iteration and * Use `git_config_next` to advance the iteration and
* `git_config_iterator_free` when done. * `git_config_iterator_free` when done.
* *
* The regular expression is applied case-sensitively on the normalized form of
* the variable name: the section and variable parts are lower-cased. The
* subsection is left unchanged.
*
* @param out pointer to store the iterator * @param out pointer to store the iterator
* @param cfg where to ge the variables from * @param cfg where to ge the variables from
* @param regexp regular expression to match the names * @param regexp regular expression to match the names
...@@ -568,8 +584,12 @@ GIT_EXTERN(int) git_config_iterator_glob_new(git_config_iterator **out, const gi ...@@ -568,8 +584,12 @@ GIT_EXTERN(int) git_config_iterator_glob_new(git_config_iterator **out, const gi
* regular expression that filters which config keys are passed to the * regular expression that filters which config keys are passed to the
* callback. * callback.
* *
* The pointers passed to the callback are only valid as long as the * The regular expression is applied case-sensitively on the normalized form of
* iteration is ongoing. * the variable name: the section and variable parts are lower-cased. The
* subsection is left unchanged.
*
* The regular expression is applied case-sensitively on the normalized form of
* the variable name: the case-insensitive parts are lower-case.
* *
* @param cfg where to get the variables from * @param cfg where to get the variables from
* @param regexp regular expression to match against config names * @param regexp regular expression to match against config names
...@@ -696,6 +716,10 @@ GIT_EXTERN(int) git_config_parse_path(git_buf *out, const char *value); ...@@ -696,6 +716,10 @@ GIT_EXTERN(int) git_config_parse_path(git_buf *out, const char *value);
* This behaviors like `git_config_foreach_match` except instead of all config * This behaviors like `git_config_foreach_match` except instead of all config
* entries it just enumerates through the given backend entry. * entries it just enumerates through the given backend entry.
* *
* The regular expression is applied case-sensitively on the normalized form of
* the variable name: the section and variable parts are lower-cased. The
* subsection is left unchanged.
*
* @param backend where to get the variables from * @param backend where to get the variables from
* @param regexp regular expression to match against config names (can be NULL) * @param regexp regular expression to match against config names (can be NULL)
* @param callback the function to call on each variable * @param callback the function to call on each variable
......
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