git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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);
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 13 in “What's cooking in git.git (Mar 2011, #06; Thu, 31)”
  1. Junio C HamanoMar 31, 2011
  2. Let's make our cycles shorterJunio C Hamano, Mar 31, 2011
  3. Sebastien DoucheApr 25, 2011
  4. Junio C HamanoApr 25, 2011
  5. Sebastien DoucheJun 13, 2011
  6. git diff -D: omit the preimage of deletesMichael J Gruber, Apr 1, 2011
  7. Junio C HamanoApr 1, 2011
  8. Junio C HamanoApr 3, 2011
  9. Junio C HamanoApr 3, 2011
  10. Michael J GruberApr 3, 2011
  11. Jeff KingApr 1, 2011
  12. Junio C HamanoApr 1, 2011
  13. Jeff KingApr 1, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.