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 07:06:38PM -0700, Linus Torvalds wrote:

> For diffing against (or using) the index, the "-r" is superfluous.
> 
> Why? Because the index is always the *full* list of files. It's "flat".
> 
> However, when you diff two trees, the -r makes a difference.
> 
> So I think you'd find a difference if you actually diffed two commits 
> with "git diff tree2..tree2".

Ah...right you are.

So if I "git diff" two commits with --raw or --name-status, we don't
recurse into recurse into subdirectories (because they are actually
subtrees). If I "git diff" a commit against the index using --raw or
--name-status, I we do recurse (since the index is actually flat). But
if I "git diff" using -p, --stat, or --summary, it _does_ recurse no
matter what I'm diffing.

Does anybody else find this behavior confusing? I can understand why
diff-tree might not recurse by default, but I wonder if porcelain like
git-diff should try to be a little more consistent and always recurse.

Something like:

diff --git a/builtin-diff.c b/builtin-diff.c
index 7f367b6..b48121e 100644
--- a/builtin-diff.c
+++ b/builtin-diff.c
@@ -233,6 +233,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
 			die("diff_setup_done failed");
 	}
 	rev.diffopt.allow_external = 1;
+	rev.diffopt.recursive = 1;
 
 	/* Do we have --cached and not have a pending object, then
 	 * default to HEAD by hand.  Eek.

For comparison, whatchanged, show, and format-patch are already always
recursive. log is not.

-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