Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] git diff -D: omit the preimage of deletes

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:50:58
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

Junio C Hamano [off-list ref] writes:
I would have expected that the patch relative to jc/diff-irreversible-delete
topic would consist only of changes to diff.c:emit_rewrite_diff(), docs
and tests.
Here is an "in other words" follow-up.  Your tests looked reasonable (and
pass with this patch on top of what has been queued in 'pu').


 diff.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/diff.c b/diff.c
index 5c66a53..05f443c 100644
--- a/diff.c
+++ b/diff.c
@@ -572,11 +572,14 @@ static void emit_rewrite_diff(const char *name_a,
 		line_prefix, metainfo, a_name.buf, name_a_tab, reset,
 		line_prefix, metainfo, b_name.buf, name_b_tab, reset,
 		line_prefix, fraginfo);
-	print_line_count(o->file, lc_a);
+	if (!o->irreversible_delete)
+		print_line_count(o->file, lc_a);
+	else
+		fprintf(o->file, "?,?");
 	fprintf(o->file, " +");
 	print_line_count(o->file, lc_b);
 	fprintf(o->file, " @@%s\n", reset);
-	if (lc_a)
+	if (lc_a && !o->irreversible_delete)
 		emit_rewrite_lines(&ecbdata, '-', data_one, size_one);
 	if (lc_b)
 		emit_rewrite_lines(&ecbdata, '+', data_two, size_two);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help