Re: [GIT PULL] arm64: Fixes for -rc4

From: Linus Torvalds
Date: Fri Oct 18 2019 - 15:17:57 EST

On Fri, Oct 18, 2019 at 10:42 AM Will Deacon <will@xxxxxxxxxx> wrote:
> Thanks, that's helpful to know for next time. I guess I'm most surprised by
> the discrepancy between the shortlog and the diffstat, whereas I intuitively
> expected them to be generated in the same way.

So logs and diffs are fundamentally different.

A log is an operation on a _set_ of commits (that's the whole point -
you don't list the beginning and the end, you list all the commits in
between), while a diff is fundamentally an operation on two end-points
and shows the code difference between those two points.

And the summary versions of those operations (shortlog and diffstat)
are no different.

So as a set operation, "shortlog" has no issues with multiple merge
bases. Doing a shortlog is still just a set difference between your
commits and the upstream commits, and the number of merge bases is
irrelevant. "List all commits that I have, but upstream doesn't have"
is a very straightforward and natural set operation.

But as a "two endpoints" operation, diffstat has real problems any
time you have more than two endpoints - when you have multiple merge
bases, you fundamentally have more than two endpoints: you have all of
the merge bases, and then you have your end result.

What you doing the merge does is to turn the multiple merge bases into
just one point: the thing you merged against now becomes the common
merge point, and now you have a "two endpoints" for the diffstat: the
thing you merged against, and your end result are now the two points
that you can diff against.

But the shortlog is always correct, because it just doesn't even care
about that whole issue.