Subject: Re: [PATCH v3 2/3] patch-id: document new behaviour

From: "Michael S. Tsirkin" <[email-masked]>
Date: Wed, 2 Apr 2014 22:02:43 +0300

On Wed, Apr 02, 2014 at 11:18:26AM -0700, Junio C Hamano wrote:
> "Michael S. Tsirkin" <[email-masked]> writes:
> 
> > On Mon, Mar 31, 2014 at 12:54:46PM -0700, Junio C Hamano wrote:
> >> "Michael S. Tsirkin" <[email-masked]> writes:
> >> 
> >> > The hash used is mostly an internal implementation detail, isn't it?
> >> 
> >> Yes, but that does not mean we can break people who keep an external
> >> database indexed with the patch-id by changing the default under
> >> them, and "they can give --unstable option to work it around" is a
> >> workaround, not a fix.  Without this change, they did not have to do
> >> anything.
> >> 
> >> I would imagine that most of these people will be using the plain
> >> vanilla "git show" output without any ordering or hunk splitting
> >> when coming up with such a key.  A possible way forward to allow the
> >> configuration that corresponds to "-O<orderfile>" while not breaking
> >> the existing users could be to make the "patch-id --stable" kick in
> >> automatically (of course, do this only when the user did not give
> >> the "--unstable" command line option to override) when we see the
> >> orderfile configuration in the repository, or when we see that the
> >> incoming patch looks like reordered (e.g. has multiple "diff --git"
> >> header lines that refer to the same path,
> >
> > This would require us to track affected files in memory.
> > Issue?
> 
> Don't we already do that in order to handle a patch that touches the
> same path more than once anyway?

At least I don't see it in builtin/patch-id.c

> I think a possibly larger issue
> might be that you would still want to do the hashing in a single
> pass so you may need to always keep two accumulated hashes, before
> you can decide if the patch is or is not a straight-forward one and
> use one of the two, but that hopefully should not require a rocket
> scientist.

But the issue is that equivalent patches would get a different hash.
This is what I tried to fix, after all.

So I think I prefer using an option and not a heuristic if you
are fine with that.
At some point in the future we might flip the default.

-- 
MST