On Thu, Aug 17, 2023 at 09:12:09AM -0700, Junio C Hamano wrote: > > diff --git a/diff.c b/diff.c > > index 38b57b589f..1dbfdaeff0 100644 > > --- a/diff.c > > +++ b/diff.c > > @@ -3853,6 +3853,8 @@ static void builtin_diffstat(const char *name_a, const char *name_b, > > && one->mode == two->mode) { > > free_diffstat_file(file); > > diffstat->nr--; > > + } else { > > + o->found_changes = 1; > > } > > } > > } > > That is much better. In all cases where the above diffstat->nr-- is > not reached and diffstat is kept is where we found changes, so an > even simpler solution that fundamentally cannot go wrong would be to > see "diffstat->nr" at the end (i.e. "are we going to show diffstat > for *any* filepair?"). If it is non-zero, we did find a difference. Yeah, without having really dug into the problem too far, that does sound a lot better. I also wonder to what degree you could apply the same strategy to other formats (I guess it depends on them removing whitespace-only changes from a structure). From the test I posted earlier, it does look like many of them have the same blind spots for mode-only changes (and I suspect addition/removal of empty files is another corner case to check). -Peff