git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Stephen R. van den Berg" <srb@cuci.nl>
To: Jakub Narebski <jnareb@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [RFC] origin link for cherry-pick and revert
Date: Tue, 9 Sep 2008 21:43:54 +0200	[thread overview]
Message-ID: <20080909194354.GA13634@cuci.nl> (raw)
In-Reply-To: <m3zlmhnx1z.fsf@localhost.localdomain>

Jakub Narebski wrote:
>"Stephen R. van den Berg" <srb@cuci.nl> writes:
>> The definition of the origin field reads as follows:

>> - There can be an arbitrary number of origin fields per commit.
>>   Typically there is going to be at most one origin field per commit.

>I understand that multiple origin fields occur if you do a squash
>merge, or if you cherry-pick multiple commits into single commit.
>For example:
> $ git cherry-pick -n <a1>
> $ git cherry-pick    <a2>
> $ git commit --amend        #; to correct commit message

Correct.

>I'm not sure if you plan to automatically add 'origin' field for
>rebase, and for interactive rebase...

That is not part of the plan so far.
Can you explain what you would be expecting in the best case?

>> - At the time of creation, the origin field contains a hash B which refers
>>   to a reachable commit pair (B, B~1).  If B has multiple parents and the pair
>>   being referred to needs to be e.g. (B, B~2), then the hash is followed by
>>   a space and followed by an integer (base10, two in this case),
>>   which designates the proper parentnr of B (see: mainline in git
>>   cherry-pick/revert).

>I think you wanted to use "(B, B^2)", which mean B and second parent
>of B.  B~2 means grandparent of B in the straight line:

Correct, sorry about the confusion, I meant B^2 instead of B~2.

>Besides I very much prefer using 'origin <sha1> <sha2>' (as proposed
>in the neighbouring subthread), which would mean together with
>'parent <parent>' (assuming that there are no other parents; if they
>are it gets even more complicated), that the following is true

>  <current> ~= <parent> + (<sha2> - <sha1>),

>where '<rev1> ~= <rev2>' means that <rev1> is based on <rev2> (perhaps
>with some fixups, corrections or the like).  Perhaps 'origin' should
>be then called 'changeset'.

The simplicity sounds inviting.  I'd like to hear from others who have
more experience (than I have) with the git vs. changeset paradigms about
this.  This allows a bit more flexibility in specifying the origin, the
question is if it's needed.

>It would also be easier on implementation to check if
>'origin'/'changeset' weak links are not broken, and to get to know
>which commits are to be protected against pruning than your proposal
>of
>  origin <"cousin" id> [<mainline = parent number>]
>where <mainline> can be omitted if it is 1 (the default).

On the contrary, my current proposal only needs to verify the validity
of a single commit, changing it like this will require the system to
verify the validity of two commits.  Given the rareness of the origin
links this will hardly present a problem, but it *does* increase
the overhead in checking a bit.

>This can also lead to replacing
>  origin <b> <a>
>  origin <c> <b>
>by
>  origin <c> <a>
>for squash merge, or squash in rebase interactive.

Ok, *that* is not possible with the original proposal.  This might just
be the reason why we'd like to go with the dual-hash link.

>> - git cherry-pick/revert allow for the creation of origin links only if
>>   the object they are referring to is presently reachable.

>Errr... shouldn't objects referenced by 'origin' links be reachable in
>order for "cherry-pick" or "revert" to succeed?

True.  But sometimes it's necessary to emphasize the obvious; call it a
preemptive strike against possible objections to the proposal.

>On the other hand this leads to the following question: what happens
>if you cherry-pick or revert a commit which has its own 'origin'
>links?

Nothing special.  cherry-pick/revert behave as if the existing origin links
were not present in the first place.

>> - git rev-list --topo-order will take origin links into account to
>>   ensure proper ordering.

>What do you mean by that?

The order in which commits are listed is defined by the fact that
descendent commits are shown before any of their parents.  The presence
of an origin link will make sure that the current commit will always
appear *before* the origin-commit it is referring to (if the
origin-commit is in the displayed set, that is).

>> - git log would show something like:

>>   commit bbb896d8e10f736bfda8f587c0009c358c9a8599
>>   Origin: d2b9dff..53d1589
>>   Origin: a1184d8..e596cdd
>>   Author: Junio C Hamano <gitster@pobox.com>
>>   Date:   Sat Aug 30 14:35:15 2008 -0700

>>   Note that for easy viewing: git diff d2b9dff..53d1589
>>   will show the exact diff the origin link is referring to.

>> - git log --graph will show a dotted line of somesort just like gitk.

>That is I guess the whole and main reason for 'origin' links to exist,
>as having this information in free-form part, i.e. in the commit
>message might lead to problems (with parsing and extracting, and
>finding spurious links).

Quite.  Also, having them in a well-defined place will allow for easy
fixups in case of rebase/filter-branch.

>> - git blame will follow and use the origin link if the object exists.

>Hmmmm... I'm not sure about that.

Care to explain your doubts?
The reason I want this behaviour, is because it's all about tracking
content, and that part of the content happens to come from somewhere
else, and therefore blame should look there to "dig deeper" into it.

>> - git merge disregards the whole origin field entirely, just like all
>>   the rest of git-core.

>Unless of course one uses more complex merge strategy, which doesn't
>take into account only endpoints (branches to be merged and merge
>bases), but is also affected in some by history...

Quite, but that is not a part of the definition of the origin field.
I can only try and make sure that we have a well-defined, well-behaved
mechanism in core git.  If someone wants to get creative with the
information presented, by all means, be my guest.

>> Anything I missed?

>How would git-rebase make use of 'origin' links.

As far as I can imagine, git rebase should alter the origin links during
rebase if they point to a commit within the strain being rebased.
Are there any other desirable use cases (for rebase)?
-- 
Sincerely,
           Stephen R. van den Berg.

"Be spontaneous!"

  parent reply	other threads:[~2008-09-09 19:45 UTC|newest]

Thread overview: 137+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-09 13:22 [RFC] origin link for cherry-pick and revert Stephen R. van den Berg
2008-09-09 13:38 ` Paolo Bonzini
2008-09-09 14:04   ` Stephen R. van den Berg
2008-09-09 13:48 ` Stephen R. van den Berg
2008-09-09 15:44 ` Jakub Narebski
2008-09-09 16:38   ` Steven Grimm
2008-09-09 19:43   ` Stephen R. van den Berg [this message]
2008-09-09 19:59     ` Jeff King
2008-09-09 20:25       ` Stephen R. van den Berg
2008-09-09 20:42       ` Junio C Hamano
2008-09-09 20:47         ` Shawn O. Pearce
2008-09-09 20:50         ` Jeff King
2008-09-09 22:35           ` Jakub Narebski
2008-09-09 23:07             ` Jakub Narebski
2008-09-10  8:10               ` Paolo Bonzini
2008-09-10  0:13         ` Stephen R. van den Berg
2008-09-10  1:59           ` Junio C Hamano
2008-09-10  5:38             ` Stephen R. van den Berg
2008-09-09 21:05       ` Junio C Hamano
2008-09-09 21:09         ` Jeff King
2008-09-09 23:36           ` Stephen R. van den Berg
2008-09-09 20:54     ` Jakub Narebski
2008-09-09 23:08       ` Stephen R. van den Berg
2008-09-09 23:35     ` Linus Torvalds
2008-09-09 23:58       ` Stephen R. van den Berg
2008-09-10  0:23         ` Linus Torvalds
2008-09-10  5:42           ` Stephen R. van den Berg
2008-09-10 15:30             ` Linus Torvalds
2008-09-10 23:09               ` Stephen R. van den Berg
2008-09-11  0:39                 ` Linus Torvalds
2008-09-11  6:22                   ` Stephen R. van den Berg
2008-09-11  8:20                     ` Jakub Narebski
2008-09-11 12:31                       ` Stephen R. van den Berg
2008-09-11 13:51                         ` Theodore Tso
2008-09-11 15:32                           ` Stephen R. van den Berg
2008-09-11 18:00                             ` Theodore Tso
2008-09-11 19:03                               ` Stephen R. van den Berg
2008-09-11 19:33                                 ` Nicolas Pitre
2008-09-11 19:44                                   ` Stephen R. van den Berg
2008-09-11 20:03                                     ` Nicolas Pitre
2008-09-11 20:24                                       ` Stephen R. van den Berg
2008-09-11 20:05                                     ` Jakub Narebski
2008-09-11 20:22                                       ` Stephen R. van den Berg
2008-09-12  0:30                                         ` A Large Angry SCM
2008-09-12  5:39                                           ` Stephen R. van den Berg
2008-09-11 20:04                                 ` Theodore Tso
2008-09-11 21:46                                   ` Jeff King
2008-09-11 22:56                                     ` Stephen R. van den Berg
2008-09-11 23:01                                       ` Jeff King
2008-09-11 23:17                                         ` Stephen R. van den Berg
2008-09-11 23:10                                     ` Linus Torvalds
2008-09-11 23:26                                       ` Jeff King
2008-09-11 23:36                                       ` Stephen R. van den Berg
2008-09-11 15:02                         ` Nicolas Pitre
2008-09-11 16:00                           ` Stephen R. van den Berg
2008-09-11 17:02                             ` Nicolas Pitre
2008-09-11 18:44                               ` Stephen R. van den Berg
2008-09-11 20:00                                 ` Nicolas Pitre
2008-09-11 21:05                               ` Junio C Hamano
2008-09-11 22:32                                 ` Stephen R. van den Berg
2008-09-11 22:40                                   ` Stephen R. van den Berg
2008-09-11 12:28                     ` A Large Angry SCM
2008-09-11 12:39                       ` Stephen R. van den Berg
2008-09-12  0:03                         ` A Large Angry SCM
2008-09-12  0:13                           ` Stephen R. van den Berg
2008-09-11 15:39                     ` Linus Torvalds
2008-09-11 16:01                       ` Paolo Bonzini
2008-09-11 16:23                         ` Linus Torvalds
2008-09-11 20:16                           ` Stephen R. van den Berg
2008-09-11 16:53                       ` Jakub Narebski
2008-09-11 19:23                       ` Stephen R. van den Berg
2008-09-11 19:45                         ` Nicolas Pitre
2008-09-11 19:55                           ` Stephen R. van den Berg
2008-09-11 20:27                             ` Nicolas Pitre
2008-09-12  8:50                               ` Stephen R. van den Berg
2008-09-11 21:01                             ` Theodore Tso
2008-09-12  8:40                               ` Stephen R. van den Berg
2008-09-10  8:30           ` Paolo Bonzini
2008-09-10 15:32             ` Linus Torvalds
2008-09-10 15:37               ` Paolo Bonzini
2008-09-10 15:43                 ` Linus Torvalds
2008-09-10 15:46                   ` Linus Torvalds
2008-09-10 15:57                     ` Paolo Bonzini
2008-09-10 23:15                       ` Stephen R. van den Berg
2008-09-10 16:23                     ` Jakub Narebski
2008-09-11 23:28                       ` Sam Vilain
2008-09-11 23:44                         ` Linus Torvalds
2008-09-12  2:24                           ` Sam Vilain
2008-09-12  5:47                           ` Stephen R. van den Berg
2008-09-12  6:19                             ` Rogan Dawes
2008-09-12  6:56                               ` Stephen R. van den Berg
2008-09-12 14:58                             ` Theodore Tso
2008-09-12 15:05                               ` Paolo Bonzini
2008-09-12 15:11                               ` Jakub Narebski
2008-09-12 15:40                                 ` Paolo Bonzini
2008-09-12 16:00                                   ` Theodore Tso
2008-09-12 15:54                               ` Stephen R. van den Berg
2008-09-12 16:19                                 ` Jeff King
2008-09-12 16:43                                   ` Stephen R. van den Berg
2008-09-12 18:44                                     ` Theodore Tso
2008-09-12 20:56                                       ` Stephen R. van den Berg
2008-09-15 12:21                                 ` Sam Vilain
2008-09-09 23:59       ` Jakub Narebski
2008-09-09 21:13 ` Petr Baudis
2008-09-09 22:56   ` Stephen R. van den Berg
2008-09-09 23:05     ` Petr Baudis
2008-09-09 23:32       ` Stephen R. van den Berg
2008-09-10  9:35       ` [RFC] origin link for cherry-pick and revert, and more about porcelain-level metadata Paolo Bonzini
2008-09-10 10:44         ` Petr Baudis
2008-09-10 11:49           ` Stephen R. van den Berg
2008-09-10 12:30             ` Petr Baudis
2008-09-10 13:14               ` Stephen R. van den Berg
2008-09-10 14:33         ` Dmitry Potapov
2008-09-10 15:15           ` Stephen R. van den Berg
2008-09-10 15:24             ` Paolo Bonzini
2008-09-10 12:21     ` [RFC] origin link for cherry-pick and revert Theodore Tso
2008-09-10 14:16       ` Stephen R. van den Berg
2008-09-10 15:10         ` Jeff King
2008-09-10 21:50           ` Stephen R. van den Berg
2008-09-10 21:54             ` Jeff King
2008-09-10 22:34               ` Stephen R. van den Berg
2008-09-10 22:55                 ` Jeff King
2008-09-10 23:19                   ` Stephen R. van den Berg
2008-09-11  5:16                     ` Paolo Bonzini
2008-09-11  7:55                       ` Stephen R. van den Berg
2008-09-11  8:45                         ` Paolo Bonzini
2008-09-11 12:33                         ` A Large Angry SCM
2008-09-11  2:46                   ` Nicolas Pitre
2008-09-10 16:18         ` Theodore Tso
2008-09-10 16:40         ` Petr Baudis
2008-09-10 17:58           ` Paolo Bonzini
2008-09-10 22:44             ` Stephen R. van den Berg
2008-09-10  8:45   ` Paolo Bonzini
2008-09-23 13:51   ` Recording "partial merges" (was: Re: [RFC] origin link for cherry-pick and revert) Peter Krefting
2008-09-10 20:32 ` [RFC] origin link for cherry-pick and revert Miklos Vajna
2008-09-10 20:55   ` Nicolas Pitre
2008-09-10 21:06     ` Miklos Vajna

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=20080909194354.GA13634@cuci.nl \
    --to=srb@cuci.nl \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.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 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).