summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorLibravatar Thomas Gummerer <t.gummerer@gmail.com>2019-07-11 17:08:48 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-07-11 14:29:27 -0700
commit430be36eb53b042c447201c778b5398df887022f (patch)
tree06f871ccc81faf1069e5735d91c6e7b784d3a1f1 /diff.c
parentrange-diff: don't remove funcname from inner diff (diff)
downloadtgif-430be36eb53b042c447201c778b5398df887022f.tar.xz
range-diff: suppress line count in outer diff
The line count in the outer diff's hunk headers of a range diff is not all that interesting. It merely shows how far along the inner diff are on both sides. That number is of no use for human readers, and range-diffs are not meant to be machine readable. In a subsequent commit we're going to add some more contextual information such as the filename corresponding to the diff to the hunk headers. Remove the unnecessary information, and just keep the "@@" to indicate that a new hunk of the outer diff is starting. Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/diff.c b/diff.c
index 1ee04e321b..4146993010 100644
--- a/diff.c
+++ b/diff.c
@@ -1673,7 +1673,10 @@ static void emit_hunk_header(struct emit_callback *ecbdata,
if (ecbdata->opt->flags.dual_color_diffed_diffs)
strbuf_addstr(&msgbuf, reverse);
strbuf_addstr(&msgbuf, frag);
- strbuf_add(&msgbuf, line, ep - line);
+ if (ecbdata->opt->flags.suppress_hunk_header_line_count)
+ strbuf_add(&msgbuf, atat, sizeof(atat));
+ else
+ strbuf_add(&msgbuf, line, ep - line);
strbuf_addstr(&msgbuf, reset);
/*