]> granicus.if.org Git - git/commitdiff
diff.c: emit_diff_symbol learns DIFF_SYMBOL_CONTEXT_FRAGINFO
authorStefan Beller <sbeller@google.com>
Fri, 30 Jun 2017 00:06:51 +0000 (17:06 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 30 Jun 2017 20:13:01 +0000 (13:13 -0700)
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c

diff --git a/diff.c b/diff.c
index 75b996c4cf17d712d7430c24869208263d05f064..6e48a129ed28001b9fe5798befa54ea427a28ca0 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -561,6 +561,7 @@ static void emit_line(struct diff_options *o, const char *set, const char *reset
 }
 
 enum diff_symbol {
+       DIFF_SYMBOL_CONTEXT_FRAGINFO,
        DIFF_SYMBOL_CONTEXT_MARKER,
        DIFF_SYMBOL_SEPARATOR
 };
@@ -570,6 +571,9 @@ static void emit_diff_symbol(struct diff_options *o, enum diff_symbol s,
 {
        const char *context, *reset;
        switch (s) {
+       case DIFF_SYMBOL_CONTEXT_FRAGINFO:
+               emit_line(o, "", "", line, len);
+               break;
        case DIFF_SYMBOL_CONTEXT_MARKER:
                context = diff_get_color_opt(o, DIFF_CONTEXT);
                reset = diff_get_color_opt(o, DIFF_RESET);
@@ -705,8 +709,8 @@ static void emit_hunk_header(struct emit_callback *ecbdata,
 
        strbuf_add(&msgbuf, line + len, org_len - len);
        strbuf_complete_line(&msgbuf);
-
-       emit_line(ecbdata->opt, "", "", msgbuf.buf, msgbuf.len);
+       emit_diff_symbol(ecbdata->opt,
+                        DIFF_SYMBOL_CONTEXT_FRAGINFO, msgbuf.buf, msgbuf.len);
        strbuf_release(&msgbuf);
 }