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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> 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))
--
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]