summaryrefslogtreecommitdiff
path: root/src/config_file.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-04-20 15:25:39 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2013-04-20 17:54:12 +0200
commite5a27f039ee3ae1291fd5084707c3f9c168f10ba (patch)
treee54682c97ebb32f2f48445e2488d08316aa7fd2b /src/config_file.c
parent8f24e65ff6f7573bc6778f5bbea7119fc9b7b626 (diff)
downloadlibgit2-e5a27f039ee3ae1291fd5084707c3f9c168f10ba.tar.gz
config: allow setting multivars when none exist yet
Adding a multivar when there are no variables with that name set should set the variable instead of failing.
Diffstat (limited to 'src/config_file.c')
-rw-r--r--src/config_file.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/config_file.c b/src/config_file.c
index 8b51ab21b..01559221e 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -481,8 +481,10 @@ static int config_set_multivar(
pos = git_strmap_lookup_index(b->values, key);
if (!git_strmap_valid_index(b->values, pos)) {
+ /* If we don't have it, behave like a normal set */
+ result = config_set(cfg, name, value);
git__free(key);
- return GIT_ENOTFOUND;
+ return result;
}
var = git_strmap_value_at(b->values, pos);