git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakob Pfender <jpfender@elegosoft.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	Jens.Lehmann@web.de, johannes.schindelin@gmx.de
Subject: [PATCH] diff-lib.c: Fix diff-files --diff-filter --quiet exit code
Date: Wed, 16 Mar 2011 17:56:33 +0100	[thread overview]
Message-ID: <4D80EBC1.7010105@elegosoft.com> (raw)

Given the following status:

	$ git status -s
	 M bar
	UU foo

There is an unexpected difference in the return code of git diff-files
when used with --quiet as opposed to --exit-code:

	$ git diff-files --diff-filter=U --quiet
	$ echo $?
	0

	$ git diff-files --diff-filter=U --exit-code
	<usual output, lots of 0's and U<TAB>foo>
	$ echo $?
	1

Notice the different return codes. Now, according to the documentation,
--quiet implies --return-code. However, the return code of the former is
clearly not correct if --return-code was supposed to be on.

This patch removes a useless bit of code that caused the return codes to
differ.

Signed-off-by: Jakob Pfender <jpfender@elegosoft.com>
---
  diff-lib.c |    4 ----
  1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/diff-lib.c b/diff-lib.c
index 392ce2b..a7aa42b 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -102,10 +102,6 @@ int run_diff_files(struct rev_info *revs, unsigned 
int option)
  		int changed;
  		unsigned dirty_submodule = 0;

-		if (DIFF_OPT_TST(&revs->diffopt, QUICK) &&
-			DIFF_OPT_TST(&revs->diffopt, HAS_CHANGES))
-			break;
-
  		if (!ce_path_match(ce, revs->prune_data))
  			continue;

-- 
1.7.0.4

             reply	other threads:[~2011-03-16 16:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-16 16:56 Jakob Pfender [this message]
2011-03-16 21:13 ` [PATCH] diff-lib.c: Fix diff-files --diff-filter --quiet exit code Junio C Hamano
2011-03-16 22:21   ` Re* " Junio C Hamano
2011-03-16 23:09     ` [PATCH] diff --quiet: disable optimization when --diff-filter=X is used Junio C Hamano
2011-03-17 11:15       ` Jakob Pfender

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=4D80EBC1.7010105@elegosoft.com \
    --to=jpfender@elegosoft.com \
    --cc=Jens.Lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    /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).