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:38 UTC
Message-ID
<7vpqp3g7pb.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7vtyefg8fi.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 8 quoted lines
> 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').

And this is the documentation part, based on your version but somewhat rewritten. Your version said "cannot be applied with -R", but at the mechanical application level, the format is deliberately designed to make `patch` and `git apply` to fail, and I think that should be mentioned together with the reason why such an option exists (i.e. for human eyeball consumption).

I'll squash these two to what is queued in 'pu'. We may want to polish it again after 1.7.5 but I think it is in much better shape now.

Thanks.
 Documentation/diff-options.txt |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index c93124b..30a00d3 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -259,6 +259,19 @@ endif::git-log[]
 	projects, so use it with caution.  Giving more than one
 	`-C` option has the same effect.
 
+-D::
+--irreversible-delete::
+	Omit the preimage for deletes, i.e. print only the header but not
+	the diff between the preimage and `/dev/null`. The resulting patch
+	is not meant to be applied with `patch` nor `git apply`; this is
+	solely for people who want to just concentrate on reviewing the
+	text after the change. In addition, the output obviously lack
+	enough information to apply such a patch in reverse, even manually,
+	hence the name of the option.
++
+When used together with `-B`, omit also the preimage in the deletion part
+of a delete/create pair.
+
 -l<num>::
 	The `-M` and `-C` options require O(n^2) processing time where n
 	is the number of potential rename/copy targets.  This
Previous: Junio C HamanoNext: Michael J Gruber
Message 9 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.