mhagger / git-imerge

Incremental merge for git
GNU General Public License v2.0
2.68k stars 126 forks source link

Why autofills if automerge succeeds? #185

Closed egpbos closed 3 years ago

egpbos commented 3 years ago

I have a large merge going on of 10314 commits into a branch with roughly 500 commits. Since it's been going on for a couple of days already, I'm trying to learn about it and merging/rebasing in general in the meantime.

One thing I don't understand is why this actually happens all the time:

Attempting automerge of 58-10314...success.
Autofilling 58-3841...success.
Autofilling 58-3842...success.
Autofilling 58-3843...success.
Autofilling 58-3844...success.
...
[until 58-10314]

If the automerge in the first line was already successful, why do all the individual merges in between still have to be manually autofilled? Can't we just immediately move along to the next commit of the first branch?

mhagger commented 3 years ago

In the general case, you might need any of the merges that are getting autofilled for a later merge. For example, suppose that the automerge corresponds to C6 in the following diagram:

o - 0 - 1  - 2  - 3  - 4  - 5  - 6  - 7  - 8  - 9  - 10  - 11    ← master
    |                            |
    A                            A6
    |                            |
    B                            B6        X
    |                            |
    C - C1 - C2 - C3 - C4 - C5 - C6
    |
    D
    |
    E

    ↑
  branch

The "autofilling" is what gives you A6, B6, C1, …, C5. Suppose you didn't autofill, then you find that there is a conflict for the merge marked X. What would you do next?

In special cases, for example rebases, it should be possible to avoid a lot of the autofilling work. I think that approach would work great but just never got around to implementing it. All of issue #66 might be useful reading.

HTH.

egpbos commented 3 years ago

Thanks for taking the time to clear that up! Indeed, I was already looking at #66 as well, very interesting discussion.