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>2009-10-29 13:45:03 +0300
committerJunio C Hamano <gitster@pobox.com>2009-10-30 19:42:56 +0300
commita4ca1465ec8afee798bf8f11d727179ca3da64a9 (patch)
treebb17119f78d5649eaeafaf07a454064c8cff4c63 /diff.c
parent168eff3c802a47a4e8a97b2ec70d86e5f605a012 (diff)
diff --color-words -U0: fix the location of hunk headers
Colored word diff without context lines firstly printed all the hunk headers among each other and then printed the diff. This was due to the code relying on getting at least one context line at the end of each hunk, where the colored words would be flushed (it is done that way to be able to ignore rewrapped lines). Noticed by Markus Heidelberg. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/diff.c b/diff.c
index e1be189742..b7ecfe3b17 100644
--- a/diff.c
+++ b/diff.c
@@ -656,6 +656,12 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
for (i = 0; i < len && line[i] == '@'; i++)
;
if (2 <= i && i < len && line[i] == ' ') {
+ /* flush --color-words even for --unified=0 */
+ if (ecbdata->diff_words &&
+ (ecbdata->diff_words->minus.text.size ||
+ ecbdata->diff_words->plus.text.size))
+ diff_words_show(ecbdata->diff_words);
+
ecbdata->nparents = i - 1;
len = sane_truncate_line(ecbdata, line, len);
emit_line(ecbdata->file,