Commit ab3f609981cd43ed09ea4d3522738322d8e81604

Nelson Elhage 2018-08-05T14:25:22

Don't error on missing section, just continue (cherry picked from commit 019409be004fb73071415750e98db03d33fada47)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/src/config_file.c b/src/config_file.c
index c95ad67..8808a16 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -1075,12 +1075,12 @@ static int read_on_variable(
 	GIT_UNUSED(line);
 	GIT_UNUSED(line_len);
 
-	if (!current_section) {
-		giterr_set(GITERR_CONFIG, "no section for key: %s", var_name);
-		return -1;
+	if (current_section) {
+		git_buf_puts(&buf, current_section);
+		git_buf_putc(&buf, '.');
 	}
 	git__strtolower(var_name);
-	git_buf_printf(&buf, "%s.%s", current_section, var_name);
+	git_buf_puts(&buf, var_name);
 	git__free(var_name);
 
 	if (git_buf_oom(&buf)) {