Re: [RFC PATCH 0/1] rebase --onto detection of already applied commits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Phillip,

On 12/15/22 17:40, Phillip Wood wrote:
Hi Cristian

On 13/12/2022 15:34, Cristian Ciocaltea wrote:
Hi Phillip,

On 12/13/22 15:04, Phillip Wood wrote:
Hi Christian

On 13/12/2022 10:37, Cristian Ciocaltea wrote:
Currently '--onto' works as if the user provided the '--reapply-cherry-picks' flag,

--onto does not affect the cherry-pick detection. When running

     git rebase --onto new-base upstream feature

any commits in upstream have been cherry-picked from feature they will not be rebased. What it does not do is look for cherry-picks in onto...feature. It would be nice to add that but I'm not sure it is straight forward to do so and still exclude commits that have been cherry-picked from feature to upstream.

The proposed patch enables looking for commits into new-base..feature range and excluding the ones reachable from upstream. Since this is a change in the existing behavior, we might need to introduce a new flag to enable it. I previously suggested to use '--no-reapply-cherry-picks' for this purpose, but now it's pretty obvious this will be a source of confusion, since the "cherry-picks" term refers to the commits picked from feature to upstream instead of new-base, as you already mentioned.

I agree it would be nice to support both exclusion ranges, but I'm not sure how complicated the implementation would be, since I don't have any previous experience with the Git internals. Could this be added as a separate feature at a later point?

If we can I'd rather add code that excludes cherry-pick both ranges. To remove the cherry-picks that are in upstream and new-base you could rework the todo list generation as follows

1. Calculate the merge-base $mb of feature and upstream
2. Store the list of commits $mb..feature in an array and in a hash
    table indexed their patch-id.
3. Walk $mb..upstream calculating the patch-id for each commit and
    removing any commit in the list from step 2 that matches.
4. If onto is equal to upstream skip to step 7
5. Calculate the merge-base $mb of feature and onto.
6. Walk $mb..new-base calculating the patch-id for each commit and
    removing any commit in the list from step 2 that matches.
7. Generate the todo list using the modified list of commits from step
    2.

I don't have much time at the moment but I can try and help a bit more in the New Year if you want.

Thank you for the implementation hints and your availability to help further! I will try to put this in practice and let you know as soon as I get something working.

Kind regards,
Cristian

Best Wishes

Phillip



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux