All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org
Subject: Re: [PATCH] diff: add a config option to control orderfile
Date: Tue, 24 Sep 2013 08:54:19 +0300	[thread overview]
Message-ID: <20130924055419.GA11208@redhat.com> (raw)
In-Reply-To: <20130923213729.GE9464@google.com>

On Mon, Sep 23, 2013 at 02:37:29PM -0700, Jonathan Nieder wrote:
> Hi,
> 
> Michael S. Tsirkin wrote:
> >> On Tue, Sep 17, 2013 at 04:56:16PM -0400, Jeff King wrote:
> 
> >>>>> A problem with both schemes, though, is that they are not
> >>>>> backwards-compatible with existing git-patch-id implementations.
> [...]
> >>> It may be esoteric enough not to worry about, though.
> 
> Yeah, I think it would be okay.  Details of the diff generation
> algorithm have changed from time to time anyway (and broken things,
> as you mentioned) and we make no guarantee about this.
> 
> [...]
> >> patch-id: make it more stable
> >>
> >> Add a new patch-id algorithm making it stable against
> >> hunk reodering:
> >> 	- prepend header to each hunk (if not there)
> >> 	- calculate SHA1 hash for each hunk separately
> >> 	- sum all hashes to get patch id
> >>
> >> Add --order-sensitive to get historical unstable behaviour.
> 
> The --order-sensitive option seems confusing.  How do I use it to
> replicate a historical patch-id?

You supply a historical diff to it :)

> If I record all options that might
> have influenced ordering (which are those?) then am I guaranteed to
> get a reproducible result?  

Maybe not. But if you have a patch on disk, you will get
old hash from it with --order-sensitive.

> So I would prefer either of the following over the above:
> 
>  a) When asked to compute the patch-id of a seekable file, use the
>     current streaming implementation until you notice a filename that
>     is out of order.  Then start over with sorted hunks (for example
>     building a table of offsets within the patch for each hunk to
>     support this).
> 
>     When asked to compute the patch-id of an unseekable file, stream
>     to a temporary file under $GIT_DIR to get a seekable file.

This can be computed in one pass: just keep two checksums around.

But the result won't be stable: if you get same patch from two
people one is ordered, the other isn't, you get two different checksums.

What are we trying to achieve here?


>  b) Unconditionally use the new patch-id definition that is stable
>     under permutation of hunks.  If and when someone complains that
>     this invalidates their old patch-ids, they can work on adding a
>     nice interface for getting the old-style patch-ids.  I suspect it
>     just wouldn't come up.

That's certainly easy to implement.

> Of course I can easily be wrong.  Thanks for a clear patch that makes
> the choices easy to reasonable about.
> 
> Thoughts?
> Jonathan

  parent reply	other threads:[~2013-09-24  5:52 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-31 19:44 [PATCH] diff: add a config option to control orderfile Michael S. Tsirkin
2013-09-03 17:12 ` Junio C Hamano
2013-09-03 21:08   ` Michael S. Tsirkin
2013-09-15  7:49     ` Michael S. Tsirkin
2013-09-15  8:08       ` Michael S. Tsirkin
2013-09-17 16:26         ` Junio C Hamano
2013-09-17 16:42           ` Michael S. Tsirkin
2013-09-17 17:24             ` Junio C Hamano
2013-09-17 17:28               ` Michael S. Tsirkin
2013-09-17 18:06                 ` Junio C Hamano
2013-09-17 19:25                   ` Michael S. Tsirkin
2013-09-17 20:14                   ` Michael S. Tsirkin
2013-09-17 20:16                     ` Michael S. Tsirkin
2013-09-17 20:18                       ` Jeff King
2013-09-17 20:38                         ` Michael S. Tsirkin
2013-09-17 20:41                           ` Michael S. Tsirkin
2013-09-17 20:56                           ` Jeff King
2013-09-17 21:03                             ` Michael S. Tsirkin
2013-09-17 21:06                               ` Jeff King
2013-09-17 21:52                             ` Junio C Hamano
2013-09-19 21:32                             ` Michael S. Tsirkin
2013-09-23 21:09                               ` Michael S. Tsirkin
2013-09-23 21:37                                 ` Jonathan Nieder
2013-09-24  5:45                                   ` Jeff King
2013-09-24  5:54                                   ` Michael S. Tsirkin [this message]
2013-09-24 19:36                                     ` Jonathan Nieder
2013-09-24 20:15                                       ` Michael S. Tsirkin
2013-09-24 21:31                                         ` Jonathan Nieder
2013-09-24 21:57                                           ` Michael S. Tsirkin
2013-09-24 22:08                                             ` Jonathan Nieder
2013-09-17 20:31                       ` Michael S. Tsirkin
2013-09-21 21:08               ` Michael S. Tsirkin

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=20130924055419.GA11208@redhat.com \
    --to=mst@redhat.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=peff@peff.net \
    /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.