git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jakub Narębski" <jnareb@gmail.com>
To: Philip Oakley <philipoakley@iee.org>, Mike Stump <mikestump@comcast.net>
Cc: "brian m. carlson" <sandals@crustytoothpaste.net>,
	git <git@vger.kernel.org>
Subject: Re: cherry picking and merge
Date: Wed, 06 Aug 2014 17:43:03 +0200	[thread overview]
Message-ID: <53E24D07.9010105@gmail.com> (raw)
In-Reply-To: <40F24BA38E03454A9BA152F6AFDE56C4@PhilipOakley>

Philip Oakley wrote:
> From: "Mike Stump" <mikestump@comcast.net>
> Sent: Friday, August 01, 2014 11:24 PM
>> On Aug 1, 2014, at 12:01 PM, Jakub Narębski <jnareb@gmail.com> wrote:

>>> It can work in Subversion because Subversion stores information about
>>> what was merged in (and this includes cherry-picks, or whatever it is
>>> named in svn) in svn:mergeinfo property. Git does not track what was
>>> merged in, instead it represent the history as the graph of revisions,
>>> and tracks merges (by storing that it came from two or more commits)
>>> and not merged-in information.
>>
>> So, as a dumb user that just wants it to work, I am unsympathetic to
>> the `but software is hard’ excuse.  I am aware that some bugs are
>> harder to fix than others.  svn took a long time to fix this bug, but
>> they did.  I can wait, the only question is, will it be a week, a
>> month, a year, or a decade.

Here Git and Subversion went in different directions, and use
different mechanisms (merge tracking vs merged-on tracking).
Both have their advantages and disadvantages.

git-merge (in the most usual case) depends only on three revisions:
the revision you merge into (current branch, ours), the revision
you are merging (merged branch, theirs), and merge base (common
ancestor).  We could have another merge strategy that examines
contents of revisions to handle cherry-picks and reverts... but
it would be more complicated, and much slower.

>>> When merging Git uses only what is being merged and its common
>>> ancestor (3-point merge). It is simple, and simple works!!!
>>
>> I gave a solution for git using branches and it works just fine.  It
>> retains the simple 3-point merge as well.

It works for this simple case, but I think it has unfortunate potential
to go silently wrong.

Also, it prevents fully removing (commits, not only refs) the branch
you cherry-picked from.  The commit you cherry picked may no longer
be (or may no longer should be) in the repository.

> At the moment there is no formal way for Git to record within the commit
> metadata the inclusion of the cherry-picked diff (the 'merge' of the fix).
>
> Thinking out of the box, the issue is that the commit parents list does
> not have a formal mechanism to allow the recording that the 'merged'
> change was the patch change from a specific commit fom somewhere else
> (which may be missing from the local repo).
>
> Perhaps it needs a style of merging-rebase where a second (last) parent
> is added but it isn't the straight <sha1>, but says 'patch-<sha1>', such
> that readers with the capability could check if that <sha1> history is
> present locally, and if so if it's correct, so that you can now 'track'
> your fixes between releases, and (hopefully) older Gits don't barf on
> that extra 'fake' parent. Somehow I suspect that older Git's would
> barf.. (not enough time to create and test such a fake commit).

Sometime ago there was long discussion about adding 'weak' references
to commit object header.

Beside the problem of backward compatibility, there was also the problem
of semantics of said reference - what does it mean?  It should work as
well for cherry-picks, for interactive rebase (maybe?), and for reverts
(which are also a problem).

Also, this could be avoided by using feature branches and merging
instead of committing to one branch and cherry-picking to other
branches. Also, git-rerere is your friend... sometimes.

>>> Have you tried git-imerge?
>>
>> No, not yet.  I’m not as interested in using it, as I would like git
>> itself to just work.

Maybe this command would make it into git proper, though probably
not written in Python (there was once merge strategy written in Python,
but currently git does not depend on Python).

-- 
Jakub Narębski

  reply	other threads:[~2014-08-06 15:43 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-01  0:58 cherry picking and merge Mike Stump
2014-08-01  2:43 ` brian m. carlson
2014-08-01 16:27   ` Jakub Narębski
2014-08-01 17:48     ` Mike Stump
2014-08-01 18:57       ` Philip Oakley
2014-08-01 22:10         ` Mike Stump
2014-08-02 10:39           ` Philip Oakley
2014-08-02 16:29           ` Philip Oakley
     [not found]       ` <CANQwDwc4YPdK+a0Oc-jWPTRyM5GiP-CMuRY1inxJY41GwUGBvQ@mail.gmail.com>
2014-08-01 19:01         ` Fwd: " Jakub Narębski
2014-08-01 22:24           ` Mike Stump
2014-08-02 11:44             ` Philip Oakley
2014-08-06 15:43               ` Jakub Narębski [this message]
2014-08-06 18:41                 ` Mike Stump
2014-08-01 20:12       ` Sam Vilain
2014-08-01 23:06         ` Mike Stump
2014-08-01 23:40           ` Nico Williams
2014-08-02  0:18             ` Alex Davidson
2014-08-06 19:11             ` Mike Stump
2014-08-06 19:44               ` Rebase safely (Re: cherry picking and merge) Nico Williams
2014-08-06 20:13                 ` Nico Williams
     [not found]                 ` <A769B84E-42D1-44AC-B0A8-0F4E68AB71FB@comcast.net>
2014-08-07  5:11                   ` Nico Williams
2014-08-08 17:34                     ` Mike Stump
2014-08-08 18:27                       ` Nico Williams
2014-08-08 16:23                   ` Fwd: " Mike Stump
2014-08-01 16:56   ` cherry picking and merge Mike Stump
2014-08-21 17:36     ` Keller, Jacob E
2014-08-21 17:58       ` Keller, Jacob E
2014-08-01 19:22 ` Nico Williams
2014-08-01 22:13   ` Mike Stump
2014-08-01 22:19     ` Nico Williams
2014-08-01 20:02 ` Jonathan Nieder
2014-08-01 20:50   ` Jonathan Nieder
2014-08-01 20:55     ` Nico Williams
2014-08-01 21:44       ` Junio C Hamano
2014-08-01 22:00         ` Nico Williams
2014-08-01 22:09           ` Junio C Hamano
2014-08-06 15:58       ` Jakub Narębski
2014-08-06 16:26         ` Nico Williams
2014-08-06 23:16         ` Junio C Hamano
2014-08-06 23:20           ` Junio C Hamano
2014-08-01 23:47     ` Mike Stump
2014-08-01 22:35   ` Mike Stump
2014-08-01 22:42     ` Jonathan Nieder

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=53E24D07.9010105@gmail.com \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=mikestump@comcast.net \
    --cc=philipoakley@iee.org \
    --cc=sandals@crustytoothpaste.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).