From: Junio C Hamano <gitster@pobox.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: git@vger.kernel.org, sunshine@sunshineco.com, jrnieder@gmail.com,
peff@peff.net
Subject: Re: [PATCH v3 1/3] patch-id: make it stable against hunk reordering
Date: Mon, 31 Mar 2014 10:59:50 -0700 [thread overview]
Message-ID: <xmqqk3ba6yg9.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1396202583-2572-1-git-send-email-mst@redhat.com> (Michael S. Tsirkin's message of "Sun, 30 Mar 2014 21:09:22 +0300")
"Michael S. Tsirkin" <mst@redhat.com> writes:
> Patch id changes if users
> 1. reorder file diffs that make up a patch
> or
> 2. split a patch up to multiple diffs that touch the same path
> (keeping hunks within a single diff ordered to make patch valid).
>
> As the result is functionally equivalent, a different patch id is
> surprising to many users.
> In particular, reordering files using diff -O is helpful to make patches
> more readable (e.g. API header diff before implementation diff).
>
> Change patch-id behaviour making it stable against these two kinds
> of patch change:
> 1. calculate SHA1 hash for each hunk separately and sum all hashes
> (using a symmetrical sum) to get patch id
> 2. hash the file-level headers together with each hunk (not just the
> first hunk)
>
> We use a 20byte sum and not xor - since xor would give 0 output
> for patches that have two identical diffs, which isn't all that
> unlikely (e.g. append the same line in two places).
>
> Add a new flag --unstable to get the historical behaviour.
>
> Add --stable which is a nop, for symmetry.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>
> changes from v2:
> several bugfixes
> changes from v1:
> hanges from v1: documented motivation for supporting
> diff splitting (and not just file reordering).
> No code changes.
>
> builtin/patch-id.c | 72 ++++++++++++++++++++++++++++++++++++++++++------------
> 1 file changed, 56 insertions(+), 16 deletions(-)
Does this have to interact or be consistent with patch-ids.c which
is the real patch-id machinery used to filter like-changes out by
"cherry-pick" and "log --cherry-pick"?
This series opens a very interesting opportunity by making it
possible to introduce the equivalence between two patches that touch
the same file and a single patch that concatenates hunks from these
two patches.
One example I am wondering about is perhaps this could be used to
detect two branches, both sides with many patches cherry-picked from
the same source, but some patches squashed together on one branch
but not on the other. It would be very nice if you can detect that
two sets of patches are equivalent taken as a whole in such a
situation while rebasing one on top of the other.
Another example is that another mode that gives a set of broken-up
patch-ids for each hunk contained in the input. Suppose there is a
patch that is only meant to be used on the proprietary fork of an
open source project, and the project releases the open source
portion by cherry-picking topics from the development tree used for
the proprietary "trunk". The integration service of such a project
used to prepare the open source branch may want to have a
pre-receive hook that says "do not merge any commit to cause this
this hunk appear in the result, no matter what other changes the
patches in the commit may bring in", and broken-down patch-ids
(e.g. "diff HEAD...$commit | patch-id --individual") may be an
ingredient to implement such a hook. There may be interesting
applications other than such a "broken-down patch-ids" that can be
based on the enhancement you are presenting here.
next prev parent reply other threads:[~2014-03-31 18:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-30 18:09 [PATCH v3 1/3] patch-id: make it stable against hunk reordering Michael S. Tsirkin
2014-03-30 18:09 ` [PATCH v3 2/3] patch-id: document new behaviour Michael S. Tsirkin
2014-03-31 19:08 ` Junio C Hamano
2014-03-31 19:26 ` Michael S. Tsirkin
2014-03-31 19:54 ` Junio C Hamano
2014-03-31 20:42 ` Michael S. Tsirkin
2014-04-02 18:18 ` Junio C Hamano
2014-04-02 19:02 ` Michael S. Tsirkin
2014-04-03 15:42 ` Junio C Hamano
2014-03-30 18:09 ` [PATCH v3 3/3] patch-id-test: test --stable and --unstable flags Michael S. Tsirkin
2014-03-31 19:29 ` Junio C Hamano
2014-03-31 17:59 ` Junio C Hamano [this message]
2014-03-31 19:04 ` [PATCH v3 1/3] patch-id: make it stable against hunk reordering Michael S. Tsirkin
2014-03-31 19:35 ` Junio C Hamano
2014-03-31 22:05 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqk3ba6yg9.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=mst@redhat.com \
--cc=peff@peff.net \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.