aboutsummaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorFrank Lichtenheld <frank@lichtenheld.de>2008-02-11 01:23:03 +0100
committerJunio C Hamano <gitster@pobox.com>2008-02-10 18:42:06 -0800
commit7a31cc0f96681d6cba54b38bb87daa2440bef448 (patch)
treee3305fc2187232fdf8cf67c34a21409670126a77 /config.c
parent527270689c364bea9b0630df9bae5e09c2071c1e (diff)
downloadgit-7a31cc0f96681d6cba54b38bb87daa2440bef448.tar.gz
git-7a31cc0f96681d6cba54b38bb87daa2440bef448.tar.xz
config: Fix --unset for continuation lines
find_beginning_of_line didn't take into account that the previous line might have ended with \ in which case it shouldn't stop but continue its search. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.c')
-rw-r--r--config.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/config.c b/config.c
index 526a3f429..e799f40db 100644
--- a/config.c
+++ b/config.c
@@ -701,12 +701,17 @@ static ssize_t find_beginning_of_line(const char* contents, size_t size,
size_t equal_offset = size, bracket_offset = size;
ssize_t offset;
+contline:
for (offset = offset_-2; offset > 0
&& contents[offset] != '\n'; offset--)
switch (contents[offset]) {
case '=': equal_offset = offset; break;
case ']': bracket_offset = offset; break;
}
+ if (offset > 0 && contents[offset-1] == '\\') {
+ offset_ = offset;
+ goto contline;
+ }
if (bracket_offset < equal_offset) {
*found_bracket = 1;
offset = bracket_offset+1;