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

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2006-12-22 05:20:11 +0300
committerJunio C Hamano <junkio@cox.net>2006-12-22 07:31:14 +0300
commite6d40d65df07059fc655fabe62fa5b575ead7815 (patch)
tree732e263f429db3702fd770b89fa4279a1dc36e2d /diff.c
parentec722203ee43beed8e4feac84af4307eb68f1ba3 (diff)
diff --check: fix off by one error
When parsing the diff line starting with '@@', the line number of the '+' file is parsed. For the subsequent line parses, the line number should therefore be incremented after the parse, not before it. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/diff.c b/diff.c
index 33153787b8..b003c00016 100644
--- a/diff.c
+++ b/diff.c
@@ -825,8 +825,6 @@ static void checkdiff_consume(void *priv, char *line, unsigned long len)
if (line[0] == '+') {
int i, spaces = 0;
- data->lineno++;
-
/* check space before tab */
for (i = 1; i < len && (line[i] == ' ' || line[i] == '\t'); i++)
if (line[i] == ' ')
@@ -841,6 +839,8 @@ static void checkdiff_consume(void *priv, char *line, unsigned long len)
if (isspace(line[len - 1]))
printf("%s:%d: white space at end: %.*s\n",
data->filename, data->lineno, (int)len, line);
+
+ data->lineno++;
} else if (line[0] == ' ')
data->lineno++;
else if (line[0] == '@') {