git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH] Documentation/git-diff: remove -r from --name-status example
Date: Sun, 29 Jul 2007 08:19:48 -0400	[thread overview]
Message-ID: <20070729121948.GA21983@coredump.intra.peff.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0707291258410.14781@racer.site>

On Sun, Jul 29, 2007 at 01:04:13PM +0100, Johannes Schindelin wrote:

> The idea is this: when "--quiet" was given, we do not output anything, and 
> therefore do not have to recurse into the directories, because we already 
> know that there are differences when a _tree_ is different.  I do not 
> remember all details of the "--quiet" implementation, but I think that it
> 
> - exits early (as you said)
> 
> - does not turn on "recursive" to avoid unnecessary work.

OK, looking through the code, this works _sometimes_. If I say "git-diff
--quiet" then it will not recurse. If I say "git-diff -p --quiet" then
it will (even though we never show the -p output).

Since --quiet supersedes all output formats, I think it probably should
just clear the recursive option entirely. In which case rather than
special-casing quiet to avoid recursion in git-diff, we can simply turn
on recursion before parsing options (and it will get turned off
correctly by any diff options that need to do so).

Something like:

diff --git a/builtin-diff.c b/builtin-diff.c
index 7f367b6..e6d10bd 100644
--- a/builtin-diff.c
+++ b/builtin-diff.c
@@ -229,6 +229,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
 		argc = setup_revisions(argc, argv, &rev, NULL);
 	if (!rev.diffopt.output_format) {
 		rev.diffopt.output_format = DIFF_FORMAT_PATCH;
+		rev.diffopt.recursive = 1;
 		if (diff_setup_done(&rev.diffopt) < 0)
 			die("diff_setup_done failed");
 	}
diff --git a/diff.c b/diff.c
index a5fc56b..aeae1a3 100644
--- a/diff.c
+++ b/diff.c
@@ -2182,6 +2182,7 @@ int diff_setup_done(struct diff_options *options)
 	if (options->quiet) {
 		options->output_format = DIFF_FORMAT_NO_OUTPUT;
 		options->exit_with_status = 1;
+		options->recursive = 0;
 	}
 
 	/*

But maybe that doesn't work because some of the options need recursion
turned on, even if --quiet is specified. I have to admit, there are a
lot of code paths here and I'm not sure how all of them interact with
the recursive option. So perhaps it is better to just special case
options->quiet as you suggested.

-Peff

  reply	other threads:[~2007-07-29 12:20 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
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 [this message]
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=20070729121948.GA21983@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).