From: Jeff King <peff@peff.net>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org, Jakub Narebski <jnareb@gmail.com>,
Jon Smirl <jonsmirl@gmail.com>
Subject: Re: [PATCH] Documentation/git-diff: remove -r from --name-status example
Date: Sun, 29 Jul 2007 00:11:59 -0400 [thread overview]
Message-ID: <20070729041159.GA5544@coredump.intra.peff.net> (raw)
In-Reply-To: <alpine.LFD.0.999.0707281905050.3442@woody.linux-foundation.org>
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
next prev parent reply other threads:[~2007-07-29 4:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-29 0:24 [PATCH] Documentation/git-diff: remove -r from --name-status example Jeff King
2007-07-29 2:06 ` Linus Torvalds
2007-07-29 4:11 ` Jeff King [this message]
2007-07-29 4:27 ` Linus Torvalds
2007-07-29 4:48 ` Junio C Hamano
2007-07-29 4:56 ` Jeff King
2007-07-29 8:23 ` David Kastrup
2007-07-29 9:36 ` Junio C Hamano
2007-07-29 9:49 ` Jeff King
2007-07-29 11:14 ` Johannes Schindelin
2007-07-29 11:33 ` David Kastrup
2007-07-29 11:38 ` Jeff King
2007-07-29 12:04 ` Johannes Schindelin
2007-07-29 12:19 ` Jeff King
2007-07-29 12:24 ` Johannes Schindelin
2007-07-29 12:26 ` Jeff King
2007-07-29 16:51 ` Linus Torvalds
2007-07-29 4:52 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070729041159.GA5544@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jnareb@gmail.com \
--cc=jonsmirl@gmail.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).