summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2012-03-26 12:10:05 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2012-03-26 12:10:05 -0700
commited6ce4382b5cb34e98ca3db2f19de82a037da322 (patch)
treee9065a1c320f0d6363667eef498a7fd56f7ec90c /config.c
parentgrep doc: add --break / --heading / -W to synopsis (diff)
parentconfig: report errors at the EOL with correct line number (diff)
downloadtgif-ed6ce4382b5cb34e98ca3db2f19de82a037da322.tar.xz
Merge branch 'ms/maint-config-error-at-eol-linecount' into maint
* ms/maint-config-error-at-eol-linecount: config: report errors at the EOL with correct line number
Diffstat (limited to 'config.c')
-rw-r--r--config.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/config.c b/config.c
index 40f9c6d103..818ba6df00 100644
--- a/config.c
+++ b/config.c
@@ -135,8 +135,10 @@ static char *parse_value(void)
for (;;) {
int c = get_next_char();
if (c == '\n') {
- if (quote)
+ if (quote) {
+ cf->linenr--;
return NULL;
+ }
return cf->value.buf;
}
if (comment)
@@ -226,7 +228,7 @@ static int get_extended_base_var(char *name, int baselen, int c)
{
do {
if (c == '\n')
- return -1;
+ goto error_incomplete_line;
c = get_next_char();
} while (isspace(c));
@@ -238,13 +240,13 @@ static int get_extended_base_var(char *name, int baselen, int c)
for (;;) {
int c = get_next_char();
if (c == '\n')
- return -1;
+ goto error_incomplete_line;
if (c == '"')
break;
if (c == '\\') {
c = get_next_char();
if (c == '\n')
- return -1;
+ goto error_incomplete_line;
}
name[baselen++] = c;
if (baselen > MAXNAME / 2)
@@ -255,6 +257,9 @@ static int get_extended_base_var(char *name, int baselen, int c)
if (get_next_char() != ']')
return -1;
return baselen;
+error_incomplete_line:
+ cf->linenr--;
+ return -1;
}
static int get_base_var(char *name)