git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>,
	Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [RFC PATCH 0/1] rebase --onto detection of already applied commits
Date: Thu, 15 Dec 2022 17:07:03 +0000	[thread overview]
Message-ID: <e174b4a6-f5c2-6856-23bf-216cbab86fbf@dunelm.org.uk> (raw)
In-Reply-To: <ee59112a-bd07-53cc-dfe3-6ee6f2342287@collabora.com>

On 15/12/2022 16:02, Cristian Ciocaltea wrote:
> 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.

I'd start by looking at the existing todo list generation in 
sequencer.c:sequencer_make_script()

Best Wishes

Phillip

      reply	other threads:[~2022-12-15 17:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-12 11:35 [RFC PATCH 0/1] rebase --onto detection of already applied commits Cristian Ciocaltea
2022-12-12 11:35 ` [RFC PATCH 1/1] rebase --onto: Skip previously " Cristian Ciocaltea
2022-12-12 12:27   ` Ævar Arnfjörð Bjarmason
2022-12-12 15:37     ` Cristian Ciocaltea
2022-12-13  0:13 ` [RFC PATCH 0/1] rebase --onto detection of already " Junio C Hamano
2022-12-13 10:37   ` Cristian Ciocaltea
2022-12-13 12:38     ` Junio C Hamano
2022-12-13 13:04     ` Phillip Wood
2022-12-13 15:34       ` Cristian Ciocaltea
2022-12-15 15:40         ` Phillip Wood
2022-12-15 16:02           ` Cristian Ciocaltea
2022-12-15 17:07             ` Phillip Wood [this message]

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=e174b4a6-f5c2-6856-23bf-216cbab86fbf@dunelm.org.uk \
    --to=phillip.wood123@gmail.com \
    --cc=cristian.ciocaltea@collabora.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=phillip.wood@dunelm.org.uk \
    /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).