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

Re: [PATCH] Documentation/git-diff: remove -r from --name-status example

From
Jeff King <peff@peff.net>
Date
Jul 29, 2007, 04:52 UTC
Message-ID
<20070729045217.GA6858@coredump.intra.peff.net>
In-Reply-To
<alpine.LFD.0.999.0707282119010.3442@woody.linux-foundation.org>
On Sat, Jul 28, 2007 at 09:27:18PM -0700, Linus Torvalds wrote:
> The fact that "--name-status" is not considered a "patch" is an 
> implementation detail, and I would _almost_ suggest that we just make it 
> always recurse, and leave thenon-recursing case for _just_ "--raw". But 
> that is a separate decision.
I think it makes some sense, but I'm not sure it is worth it for two
reasons:
  1. --raw and --name-status are very linked in the diff code. Turning
     on recursion for --name-status without --raw will be somewhat
     hairy.
  2. If all of the porcelain tools turn on recursion anyway, that
     implementation detail just goes away anyway.

On the other hand, it looks like we just set options->recursive = 1 for most formats anyway. So doing "git-log --raw" will not recurse, but "git-log --raw -p" will recurse for _both_ the raw and the log formats. Which I think is a bit non-intuitive, but it certainly makes the patch much simpler:

diff --git a/diff.c b/diff.c
index a5fc56b..3137cac 100644
--- a/diff.c
+++ b/diff.c
@@ -2151,6 +2151,7 @@ int diff_setup_done(struct diff_options *options)
 				      DIFF_FORMAT_DIFFSTAT |
 				      DIFF_FORMAT_SHORTSTAT |
 				      DIFF_FORMAT_SUMMARY |
+				      DIFF_FORMAT_NAME_STATUS |
 				      DIFF_FORMAT_CHECKDIFF))
 		options->recursive = 1;
 	/*

> It *is* a change in behaviour, though, so I can understand if Junio 
> doesn't think it's appropriate this late in the 1.5.3 series.

Agreed.

> "git log", of course, defaults to no output at all, so the only way to get 
> non-recursive behaviour is to ask for "--raw", and then having to specify 
> explicitly whether to get recursion or not make sense. Once you want raw 
> output, it really _is_ your choice.

I wonder if git-log should match the behavior of the other commands. I
have often see git-whatchanged explained as the equivalent of "git-log
-p" but that's not exactly true. Similarly, git-show has been explained
as "git-log -p for the first commit." And using "-p" they are basically
the same. But it means I can't just replace all use of "git-whatchanged"
with "git-log" and get the exact same behavior.  I think it makes to
harmonize these little "gotchas".

-Peff
Previous: Linus Torvalds
Message 18 of 18 in “Documentation/git-diff: remove -r from --name-status example”
  1. Documentation/git-diff: remove -r from --name-status exampleJeff King, Jul 29, 2007
  2. Linus TorvaldsJul 29, 2007
  3. Jeff KingJul 29, 2007
  4. Linus TorvaldsJul 29, 2007
  5. Junio C HamanoJul 29, 2007
  6. Jeff KingJul 29, 2007
  7. David KastrupJul 29, 2007
  8. Junio C HamanoJul 29, 2007
  9. Jeff KingJul 29, 2007
  10. Johannes SchindelinJul 29, 2007
  11. David KastrupJul 29, 2007
  12. Jeff KingJul 29, 2007
  13. Johannes SchindelinJul 29, 2007
  14. Jeff KingJul 29, 2007
  15. Johannes SchindelinJul 29, 2007
  16. Jeff KingJul 29, 2007
  17. Linus TorvaldsJul 29, 2007
  18. Jeff KingJul 29, 2007

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.