Skip to content

Commit 358cc2e

Browse files
authored
Merge pull request libgit2#4396 from libgit2/cmn/config-regex-is-normalised
config: specify how we match the regular expressions
2 parents d11c4a1 + 2f89bd9 commit 358cc2e

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

include/git2/config.h

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,10 @@ GIT_EXTERN(int) git_config_get_string_buf(git_buf *out, const git_config *cfg, c
401401
*
402402
* The callback will be called on each variable found
403403
*
404+
* The regular expression is applied case-sensitively on the normalized form of
405+
* the variable name: the section and variable parts are lower-cased. The
406+
* subsection is left unchanged.
407+
*
404408
* @param cfg where to look for the variable
405409
* @param name the variable's name
406410
* @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
413417
/**
414418
* Get each value of a multivar
415419
*
420+
* The regular expression is applied case-sensitively on the normalized form of
421+
* the variable name: the section and variable parts are lower-cased. The
422+
* subsection is left unchanged.
423+
*
416424
* @param out pointer to store the iterator
417425
* @param cfg where to look for the variable
418426
* @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
490498
/**
491499
* Set a multivar in the local config file.
492500
*
501+
* The regular expression is applied case-sensitively on the value.
502+
*
493503
* @param cfg where to look for the variable
494504
* @param name the variable's name
495505
* @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);
509519
/**
510520
* Deletes one or several entries from a multivar in the local config file.
511521
*
522+
* The regular expression is applied case-sensitively on the value.
523+
*
512524
* @param cfg where to look for the variables
513525
* @param name the variable's name
514526
* @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
555567
* Use `git_config_next` to advance the iteration and
556568
* `git_config_iterator_free` when done.
557569
*
570+
* The regular expression is applied case-sensitively on the normalized form of
571+
* the variable name: the section and variable parts are lower-cased. The
572+
* subsection is left unchanged.
573+
*
558574
* @param out pointer to store the iterator
559575
* @param cfg where to ge the variables from
560576
* @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
568584
* regular expression that filters which config keys are passed to the
569585
* callback.
570586
*
571-
* The pointers passed to the callback are only valid as long as the
572-
* iteration is ongoing.
587+
* The regular expression is applied case-sensitively on the normalized form of
588+
* the variable name: the section and variable parts are lower-cased. The
589+
* subsection is left unchanged.
590+
*
591+
* The regular expression is applied case-sensitively on the normalized form of
592+
* the variable name: the case-insensitive parts are lower-case.
573593
*
574594
* @param cfg where to get the variables from
575595
* @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);
696716
* This behaviors like `git_config_foreach_match` except instead of all config
697717
* entries it just enumerates through the given backend entry.
698718
*
719+
* The regular expression is applied case-sensitively on the normalized form of
720+
* the variable name: the section and variable parts are lower-cased. The
721+
* subsection is left unchanged.
722+
*
699723
* @param backend where to get the variables from
700724
* @param regexp regular expression to match against config names (can be NULL)
701725
* @param callback the function to call on each variable

0 commit comments

Comments
 (0)