Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-01-25 16:29:28 +0400
committerCarlos Martín Nieto <cmn@dwim.me>2013-01-25 16:29:28 +0400
commit9f35754a0ebb8004162e93ad365e0757fa39920a (patch)
tree19491e9d9dd625c47945dc727bbb6c88acda5eea /src/config_file.c
parent26ec6a6db364534077add6bc486cfeefdebfeee8 (diff)
config: support trailing backslashes
Check whether the backslash at the end of the line is being escaped or not so as not to consider it a continuation marker when it's e.g. a Windows-style path.
Diffstat (limited to 'src/config_file.c')
-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)