Skip to content

Commit 158a42a

Browse files
committed
config: specify how we match the regular expressions
We do it the same as git does: case-sensitively on the normalized form of the variable name. While here also specify that we're case-sensitive on the values when handling the values when setting or deleting multivars.
1 parent 990d2b8 commit 158a42a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

include/git2/config.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,9 @@ GIT_EXTERN(int) git_config_get_string_buf(git_buf *out, const git_config *cfg, c
398398
*
399399
* The callback will be called on each variable found
400400
*
401+
* The regular expression is applied case-sensitively on the normalized form of
402+
* the variable name: the case-insensitive parts are lower-case.
403+
*
401404
* @param cfg where to look for the variable
402405
* @param name the variable's name
403406
* @param regexp regular expression to filter which variables we're
@@ -410,6 +413,9 @@ GIT_EXTERN(int) git_config_get_multivar_foreach(const git_config *cfg, const cha
410413
/**
411414
* Get each value of a multivar
412415
*
416+
* The regular expression is applied case-sensitively on the normalized form of
417+
* the variable name: the case-insensitive parts are lower-case.
418+
*
413419
* @param out pointer to store the iterator
414420
* @param cfg where to look for the variable
415421
* @param name the variable's name
@@ -487,6 +493,8 @@ GIT_EXTERN(int) git_config_set_string(git_config *cfg, const char *name, const c
487493
/**
488494
* Set a multivar in the local config file.
489495
*
496+
* The regular expression is applied case-sensitively on the value.
497+
*
490498
* @param cfg where to look for the variable
491499
* @param name the variable's name
492500
* @param regexp a regular expression to indicate which values to replace
@@ -506,6 +514,8 @@ GIT_EXTERN(int) git_config_delete_entry(git_config *cfg, const char *name);
506514
/**
507515
* Deletes one or several entries from a multivar in the local config file.
508516
*
517+
* The regular expression is applied case-sensitively on the value.
518+
*
509519
* @param cfg where to look for the variables
510520
* @param name the variable's name
511521
* @param regexp a regular expression to indicate which values to delete
@@ -552,6 +562,9 @@ GIT_EXTERN(int) git_config_iterator_new(git_config_iterator **out, const git_con
552562
* Use `git_config_next` to advance the iteration and
553563
* `git_config_iterator_free` when done.
554564
*
565+
* The regular expression is applied case-sensitively on the normalized form of
566+
* the variable name: the case-insensitive parts are lower-case.
567+
*
555568
* @param out pointer to store the iterator
556569
* @param cfg where to ge the variables from
557570
* @param regexp regular expression to match the names
@@ -568,6 +581,9 @@ GIT_EXTERN(int) git_config_iterator_glob_new(git_config_iterator **out, const gi
568581
* The pointers passed to the callback are only valid as long as the
569582
* iteration is ongoing.
570583
*
584+
* The regular expression is applied case-sensitively on the normalized form of
585+
* the variable name: the case-insensitive parts are lower-case.
586+
*
571587
* @param cfg where to get the variables from
572588
* @param regexp regular expression to match against config names
573589
* @param callback the function to call on each variable
@@ -693,6 +709,9 @@ GIT_EXTERN(int) git_config_parse_path(git_buf *out, const char *value);
693709
* This behaviors like `git_config_foreach_match` except instead of all config
694710
* entries it just enumerates through the given backend entry.
695711
*
712+
* The regular expression is applied case-sensitively on the normalized form of
713+
* the variable name: the case-insensitive parts are lower-case.
714+
*
696715
* @param backend where to get the variables from
697716
* @param regexp regular expression to match against config names (can be NULL)
698717
* @param callback the function to call on each variable

0 commit comments

Comments
 (0)