summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config_file.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/config_file.c b/src/config_file.c
index 8be298389..2b1be05bf 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -1319,8 +1319,15 @@ out:
static int is_multiline_var(const char *str)
{
+ int count = 0;
const char *end = str + strlen(str);
- return (end > str) && (end[-1] == '\\');
+ while (end > str && end[-1] == '\\') {
+ count++;
+ end--;
+ }
+
+ /* An odd number means last backslash wasn't escaped, so it's multiline */
+ return (end > str) && (count & 1);
}
static int parse_multiline_variable(diskfile_backend *cfg, git_buf *value, int in_quotes)