git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re* [PATCH] diff-lib.c: Fix diff-files --diff-filter --quiet exit code

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 16, 2011, 22:21 UTC
Message-ID
<7vwrjy670r.fsf_-_@alter.siamese.dyndns.org>
In-Reply-To
<7v62ri7oqm.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 10 quoted lines
> The code notices that the caller, by specifying --quiet, does not want any
> details of the changes and instead wants to know if there is a change or
> not.  And it breaks out of the loop because it already found what it
> wanted to know, namely, there is a change.
>
> When you have a post-process filter (like -w or -S), the path we found to
> be different here may be uninteresting and there may be no output (hence
> we should exit with status 0).  So it is true that the optimization you
> are removing needs to be disabled in _some_ situations, and the current
> code doesn't, and it needs fixing.

What I was hinting at was perhaps to do it something like the attached; it is totally untested, and merely for illustration purposes.

I didn't even try to cover -w/-S which may or may not involve inspecting DIFF_FROM_CONTENTS bit in the options.

 diff-lib.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/diff-lib.c b/diff-lib.c
index 1e22992..2870de4 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -103,7 +103,8 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
 		unsigned dirty_submodule = 0;
 
 		if (DIFF_OPT_TST(&revs->diffopt, QUICK) &&
-			DIFF_OPT_TST(&revs->diffopt, HAS_CHANGES))
+		    !revs->diffopt.filter &&
+		    DIFF_OPT_TST(&revs->diffopt, HAS_CHANGES))
 			break;
 
 		if (!ce_path_match(ce, &revs->prune_data))
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 5 in “diff-lib.c: Fix diff-files --diff-filter --quiet exit code”
  1. diff-lib.c: Fix diff-files --diff-filter --quiet exit codeJakob Pfender, Mar 16, 2011
  2. Junio C HamanoMar 16, 2011
  3. Re* [PATCH] diff-lib.c: Fix diff-files --diff-filter --quiet exit codeJunio C Hamano, Mar 16, 2011
  4. diff --quiet: disable optimization when --diff-filter=X is usedJunio C Hamano, Mar 16, 2011
  5. Jakob PfenderMar 17, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.