summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
authorVicent Martí <tanoku@gmail.com>2012-02-22 11:12:20 -0800
committerVicent Martí <tanoku@gmail.com>2012-02-22 11:12:20 -0800
commit8d36b253e2a96b493f45ebc89260627c002b0bab (patch)
tree89e2810a28b1320989bc7275af7cc52335c3da51 /include/git2
parent20ed8983eabc219f9ab1006f4c8303f7c5c3ecf4 (diff)
parentb13dbb91eaac4d653df5fccd9c180cc8c80ff092 (diff)
downloadlibgit2-8d36b253e2a96b493f45ebc89260627c002b0bab.tar.gz
Merge pull request #565 from carlosmn/multimap
Add config multivar support
Diffstat (limited to 'include/git2')
-rw-r--r--include/git2/config.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/git2/config.h b/include/git2/config.h
index afa661fc5..8a0f58937 100644
--- a/include/git2/config.h
+++ b/include/git2/config.h
@@ -29,7 +29,9 @@ struct git_config_file {
/* Open means open the file/database and parse if necessary */
int (*open)(struct git_config_file *);
int (*get)(struct git_config_file *, const char *key, const char **value);
+ int (*get_multivar)(struct git_config_file *, const char *key, const char *regexp, int (*fn)(const char *, void *), void *data);
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);
void (*free)(struct git_config_file *);
@@ -206,6 +208,20 @@ GIT_EXTERN(int) git_config_get_bool(git_config *cfg, const char *name, int *out)
GIT_EXTERN(int) git_config_get_string(git_config *cfg, const char *name, const char **out);
/**
+ * Get each value of a multivar.
+ *
+ * The callback will be called on each variable found
+ *
+ * @param cfg where to look for the variable
+ * @param name the variable's name
+ * @param regexp regular expression to filter which variables we're
+ * interested in. Use NULL to indicate all
+ * @param fn the function to be called on each value of the variable
+ * @param data opaque pointer to pass to the callback
+ */
+GIT_EXTERN(int) git_config_get_multivar(git_config *cfg, const char *name, const char *regexp, int (*fn)(const char *, void *), void *data);
+
+/**
* Set the value of an integer config variable.
*
* @param cfg where to look for the variable
@@ -248,6 +264,17 @@ GIT_EXTERN(int) git_config_set_bool(git_config *cfg, const char *name, int value
*/
GIT_EXTERN(int) git_config_set_string(git_config *cfg, const char *name, const char *value);
+
+/**
+ * Set a multivar
+ *
+ * @param cfg where to look for the variable
+ * @param name the variable's name
+ * @param regexp a regular expression to indicate which values to replace
+ * @param value the new value.
+ */
+GIT_EXTERN(int) git_config_set_multivar(git_config *cfg, const char *name, const char *regexp, const char *value);
+
/**
* Delete a config variable
*