aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--diff.c6
-rwxr-xr-xt/t4034-diff-words.sh2
2 files changed, 7 insertions, 1 deletions
diff --git a/diff.c b/diff.c
index e1be18974..b7ecfe3b1 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,
diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh
index 82240cf44..21db6e95c 100755
--- a/t/t4034-diff-words.sh
+++ b/t/t4034-diff-words.sh
@@ -77,7 +77,7 @@ cat > expect <<\EOF
<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