On Mon, Aug 21, 2023 at 05:00:58PM -0400, Jeff King wrote: > Alternatively, we could put it in the caller, like so: > > diff --git a/diff.c b/diff.c > index 78f4e7518f..e7281e75eb 100644 > --- a/diff.c > +++ b/diff.c > @@ -6528,6 +6528,7 @@ void diff_flush(struct diff_options *options) > if (check_pair_status(p)) > flush_one_pair(p, options); > } > + options->found_changes = !!q->nr; > separator++; > } > > > which matches the diffstat technique (I almost thought we could share > the code, but for the diffstat we are counting what ends up in the > diffstat struct; it does not clean out the original diff_queue when it > sees a noop pair). > > I don't see a real reason to prefer one over the other. Actually, on second look these are not quite the same. Yours only triggers if check_pair_status() is true. So something like --diff-filter should affect both output and exit code. Yours gets that right, and mine does not. Sorry for the noise. :) -Peff