summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-08-09 10:56:50 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2014-08-09 11:06:49 +0200
commit9dac1f957945f706f3f557ff0b964f3d33d761b4 (patch)
tree931ad3d194ae82be8fecb861a514ef8c912bef33 /src
parentbb9e6028b8ec54c01b35f838e8eca7c81d4b751a (diff)
downloadlibgit2-9dac1f957945f706f3f557ff0b964f3d33d761b4.tar.gz
config: a multiline var can start immediately
In the check for multiline, we traverse the backslashes from the end backwards and int the end assert that we haven't gone past the beginning of the line. We make sure of this in the loop condition, but we also check in the return value. However, for certain configurations, a line in a multiline variable might be empty to aid formatting. In that case, 'end' == 'start', since we ended up looking at the first char which made it a multiline. There is no need for the (end > start) check in the return, since the loop guarantees we won't go further back than the first char in the line, and we do accept the first char to be the final backslash. This fixes #2483.
Diffstat (limited to 'src')
-rw-r--r--src/config_file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/config_file.c b/src/config_file.c
index 393a0b547..7106f18db 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -1649,7 +1649,7 @@ static int is_multiline_var(const char *str)
}
/* An odd number means last backslash wasn't escaped, so it's multiline */
- return (end > str) && (count & 1);
+ return count & 1;
}
static int parse_multiline_variable(struct reader *reader, git_buf *value, int in_quotes)