summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 168eff3)
raw | patch | inline | side by side (parent: 168eff3)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Thu, 29 Oct 2009 10:45:03 +0000 (11:45 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 30 Oct 2009 16:42:56 +0000 (09:42 -0700) |
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>
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>
diff.c | patch | blob | history | |
t/t4034-diff-words.sh | patch | blob | history |
index e1be189742f3239de028393ceabf7c6539bb0440..b7ecfe3b179cc68d18b34e675b3c0e67c13ba95d 100644 (file)
--- a/diff.c
+++ b/diff.c
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,
diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh
index 82240cf44d6afe86ba173ddd5c1b4f6c3850417e..21db6e95c4dd7ccf2f25d887fc2c42f3adcd4124 100755 (executable)
--- a/t/t4034-diff-words.sh
+++ b/t/t4034-diff-words.sh
<GREEN>aeff = aeff * ( aaa )<RESET>
EOF
-test_expect_failure 'word diff without context' '
+test_expect_success 'word diff without context' '
word_diff --color-words --unified=0