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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux