Re: [PATCH] git diff -D: omit the preimage of deletes
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 3, 2011, 06:23 UTC
- Message-ID
- <7vtyefg8fi.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <7vbp0pg4d7.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> 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);