path: root/cache.h
diff options
authorJohannes Schindelin <>2005-11-17 21:32:36 (GMT)
committerJunio C Hamano <>2005-11-20 04:47:29 (GMT)
commit10bea152a34b2bf1194ede5e0c9e5595ab2100f3 (patch)
tree64db26afffe676425fef2bace14d915fad87c381 /cache.h
parent0890098780f295f2a58658d1f6b6627e40426c72 (diff)
Add functions git_config_set() and git_config_set_multivar()
The function git_config_set() does exactly what you think it does. Given a key (in the form "core.filemode") and a value, it sets the key to the value. Example: git_config_set("core.filemode", "true"); The function git_config_set_multivar() is meant for setting variables which can have several values for the same key. Example: [diff] twohead = resolve twohead = recarsive the typo in the second line can be replaced by git_config_set_multivar("diff.twohead", "recursive", "^recar"); The third argument of the function is a POSIX extended regex which has to match the value. If there is no key/value pair with a matching value, a new key/value pair is added. These commands are also capable of unsetting (deleting) entries: git_config_set_multivar("diff.twohead", NULL, "sol"); will delete the entry twohead = resolve Signed-off-by: Johannes Schindelin <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'cache.h')
1 files changed, 2 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index 99afa2c..f93f516 100644
--- a/cache.h
+++ b/cache.h
@@ -386,6 +386,8 @@ extern int git_default_config(const char *, const char *);
extern int git_config(config_fn_t fn);
extern int git_config_int(const char *, const char *);
extern int git_config_bool(const char *, const char *);
+extern int git_config_set(const char *, const char *);
+extern int git_config_set_multivar(const char *, const char *, const char *);
#define MAX_GITNAME (1000)
extern char git_default_email[MAX_GITNAME];