]> git.ipfire.org Git - thirdparty/git.git/blobdiff - config.c
config.c: Escape backslashes in section names properly
[thirdparty/git.git] / config.c
index b0ada515b9d839fc8691bc9af320353ff323b251..f0ac4569a33630e20d6e7531d50eee55cf0dd9d4 100644 (file)
--- a/config.c
+++ b/config.c
@@ -680,7 +680,7 @@ static int store_write_section(int fd, const char* key)
        if (dot) {
                strbuf_addf(&sb, "[%.*s \"", (int)(dot - key), key);
                for (i = dot - key + 1; i < store.baselen; i++) {
-                       if (key[i] == '"')
+                       if (key[i] == '"' || key[i] == '\\')
                                strbuf_addch(&sb, '\\');
                        strbuf_addch(&sb, key[i]);
                }