Skip to contentSkip to conversation

adding merge-node to parent lines in a commit

RFC Sean 2 participants 5 messages Jun 15, 2016

lore
Share & tools
lore

Sean

author
#0 lore raw

Just a random thought presented for flamage... Would adding the merge node to each "parent" line in merge nodes be workable?

parent SHA1-PARENT SHA1-MERGE-NODE

It's not exactly clear cut I guess, especially in the case of multi-parent
merges, but it would make descending the history slightly easier. It
would let you look at any merge, and know exactly which commits were associated with that merge, without needing any repo-id or time information. This information is needed at the time of merge anyway, so recording it rather than leaving it to be calculated later makes some sense. Comments?

Cheers,
Sean

#1 lore raw

It is not clear to me ID of what object is being recorded as SHA1-MERGE-NODE in your proposal. Care to illustrate?

author
#2 lore raw
Quoted 2 lines · Junio C Hamano

It is not clear to me ID of what object is being recorded as SHA1-MERGE-NODE in your proposal. Care to illustrate?

Hey Junio,

Yes, it's pretty basic unless i'm overlooking something:

Rn---\

Quoted 2 lines
   Mn
   Mn-1

Rn-1 |
Rn-2 |
Rn-3--/
Initial

So for this particular case it's rather simple, the Rn merge node would have:

parent  Rn-1  (ommitted)
parent  Mn    Rn-3

Essentially, you are recording in the merge commit the length of each branch that represents new commits that did not exist in this repository before this merge.

But there are more complicated cases with multiple parent merges. What
this would avoid is the need to calculate common_anscestor in routines
like git-rev-list, because that information would already be stored. As
far as I know this information is already available at merge time anyway,
so recording it shouldn't be a burden. I'm not sure it buys you a ton
out the other end, but perhaps it would be slightly easier to piece the merge history back together.

Sean

#3 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"S" == Sean <[email protected]> writes:

S> Yes, it's pretty basic unless i'm overlooking something:

    Rn---\
         Mn
         Mn-1
    Rn-1  |
    Rn-2  |
    Rn-3--/
    Initial

S> So for this particular case it's rather simple, the Rn merge S> node would have:

S> parent  Rn-1  (ommitted)
S> parent  Mn    Rn-3

Isn't that something you can obtain by scanning the parents and running merge-base across them without recording it in the commit?

author
#4 lore raw
Quoted 15 lines · Junio C Hamano
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"S" == Sean <[email protected]> writes:

S> Yes, it's pretty basic unless i'm overlooking something:

    Rn---\
         Mn
         Mn-1
    Rn-1  |
    Rn-2  |
    Rn-3--/
    Initial

S> So for this particular case it's rather simple, the Rn merge S> node would have:

Quoted 6 lines
S> parent  Rn-1  (ommitted)
S> parent  Mn    Rn-3

Isn't that something you can obtain by scanning the parents and running merge-base across them without recording it in the commit?

Yes it is, and i was mistaken to think it gave more information. It would shave some time off history traversal, but nothing else.

Sean