summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-04-23 17:23:04 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2015-04-23 17:23:04 +0200
commit69c333f997f4a798082e28d5a3e2bc69f8dfdf09 (patch)
treeb18702ea9259ebee24a54f40edbcfd819278f9e9 /src
parent63e8b08dfcaa039e7bbbcfa4b5cdcea8bddf13c0 (diff)
parent9a810c5e336afe10188c7cf3fb68c598d3c2a876 (diff)
downloadlibgit2-69c333f997f4a798082e28d5a3e2bc69f8dfdf09.tar.gz
Merge pull request #3064 from rcorre/config-write-fix
config_write -- handle duplicate section headers when deleting entries
Diffstat (limited to 'src')
-rw-r--r--src/config_file.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/config_file.c b/src/config_file.c
index 350473434..7c6cb81fe 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -1460,9 +1460,12 @@ static int config_write(diskfile_backend *cfg, const char *key, const regex_t *p
* don't loose that information, but we only need to
* update post_start if we're going to use it in this
* iteration.
+ * If the section doesn't match and we are trying to delete an entry
+ * (value == NULL), we must continue searching; there may be another
+ * matching section later.
*/
if (!section_matches) {
- if (!last_section_matched) {
+ if (!last_section_matched || value == NULL) {
reader_consume_line(reader);
continue;
}