Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com>
---
 diff.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/diff.c b/diff.c
index 8af1df1..1354368 100644
--- a/diff.c
+++ b/diff.c
@@ -1037,6 +1037,16 @@ static void diff_words_show(struct diff_words_data 
*diff_words)
                diff_words->minus.text.size = 0;
                return;
        }
+       /* special case: only addition */
+       if (!diff_words->minus.text.size) {
+               fputs(line_prefix, diff_words->opt->file);
+               fn_out_diff_words_write_helper(diff_words->opt->file,
+                       &style->new, style->newline,
+                       diff_words->plus.text.size,
+                       diff_words->plus.text.ptr, line_prefix);
+               diff_words->plus.text.size = 0;
+               return;
+       }
 
        diff_words->current_plus = diff_words->plus.text.ptr;
        diff_words->last_minus = 0;
-- 
2.3.0.rc1.137.g477eb31

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to