diff options
| author | Ben Straub <bstraub@github.com> | 2012-07-17 08:08:34 -0700 |
|---|---|---|
| committer | Ben Straub <bstraub@github.com> | 2012-07-17 08:08:34 -0700 |
| commit | bfc65634050dc52e3ed6b4497ebbb511e39d6e1e (patch) | |
| tree | 32b03847b8a152b69bc3b48b6bb32e7b8621f45e /include/git2/config.h | |
| parent | 1d68fcd04b21a2c5665d0ca6a5543e7166c73457 (diff) | |
| parent | ea5d2ce4cfa6cec89e2d844a70d1eb24bb401c7d (diff) | |
| download | libgit2-bfc65634050dc52e3ed6b4497ebbb511e39d6e1e.tar.gz | |
Merge branch 'development' into clone
Diffstat (limited to 'include/git2/config.h')
| -rw-r--r-- | include/git2/config.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/include/git2/config.h b/include/git2/config.h index 36946c4a5..c46e7fc9d 100644 --- a/include/git2/config.h +++ b/include/git2/config.h @@ -33,7 +33,7 @@ struct git_config_file { int (*set)(struct git_config_file *, const char *key, const char *value); int (*set_multivar)(git_config_file *cfg, const char *name, const char *regexp, const char *value); int (*del)(struct git_config_file *, const char *key); - int (*foreach)(struct git_config_file *, int (*fn)(const char *, const char *, void *), void *data); + int (*foreach)(struct git_config_file *, const char *, int (*fn)(const char *, const char *, void *), void *data); void (*free)(struct git_config_file *); }; @@ -314,6 +314,24 @@ GIT_EXTERN(int) git_config_foreach( int (*callback)(const char *var_name, const char *value, void *payload), void *payload); +/** + * Perform an operation on each config variable matching a regular expression. + * + * This behaviors like `git_config_foreach` with an additional filter of a + * regular expression that filters which config keys are passed to the + * callback. + * + * @param cfg where to get the variables from + * @param regexp regular expression to match against config names + * @param callback the function to call on each variable + * @param payload the data to pass to the callback + * @return 0 or the return value of the callback which didn't return 0 + */ +GIT_EXTERN(int) git_config_foreach_match( + git_config *cfg, + const char *regexp, + int (*callback)(const char *var_name, const char *value, void *payload), + void *payload); /** * Query the value of a config variable and return it mapped to |
