From 0774d94d31d072a4eb0958cad74a80977495a324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Wed, 1 Feb 2012 17:21:28 +0100 Subject: [PATCH] Store multivars in the multimap --- src/config_file.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/config_file.c b/src/config_file.c index 9c4128d2b..e738064f2 100644 --- a/src/config_file.c +++ b/src/config_file.c @@ -720,7 +720,7 @@ static int config_parse(diskfile_backend *cfg_file) char *current_section = NULL; char *var_name; char *var_value; - cvar_t *var; + cvar_t *var, *existing; git_buf buf = GIT_BUF_INIT; /* Initialize the reading position */ @@ -779,8 +779,16 @@ static int config_parse(diskfile_backend *cfg_file) var->key = git_buf_detach(&buf); var->value = var_value; - /* FIXME: Actually support multivars, don't just overwrite */ - error = git_hashtable_insert(cfg_file->values, var->key, var); + /* Add or append the new config option */ + existing = git_hashtable_lookup(cfg_file->values, var->key); + if (existing == NULL) { + error = git_hashtable_insert(cfg_file->values, var->key, var); + } else { + while (existing->next != NULL) { + existing = existing->next; + } + existing->next = var; + } break; }