All of lore.kernel.org
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Philippe Blain <levraiphilippeblain@gmail.com>,
	phillip.wood@dunelm.org.uk,
	Phillip Wood via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org
Cc: Emily Shaffer <emilyshaffer@google.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Elijah Newren <newren@gmail.com>
Subject: Re: [PATCH 4/5] rebase -i: don't fork git checkout
Date: Thu, 9 Sep 2021 14:57:23 +0100	[thread overview]
Message-ID: <408dc1d3-44b8-a955-4d7b-94f23fa8a6bc@gmail.com> (raw)
In-Reply-To: <e7224105-83c6-7f12-f63a-474bd477583a@gmail.com>

Hi Philippe

On 09/09/2021 13:40, Philippe Blain wrote:
>>> While in general I think it's a good thing to avoid forking, this
>>> change might result in behavioral differences. Any config that
>>> affects 'git checkout' but not the internal 'reset.c::reset_head'
>>> function might play a role in the rebase UX.
>>>
>>> One that immediately came to mind is 'submodule.recurse'. This
>>> initial 'onto' checkout was pretty much the only part of 'git
>>> rebase' that did something useful for submodules, so it's kind of
>>> sad to see it regress.
>>
>> Thanks for pointing that out. As a non-submodule user my question
>> would be is it actually useful for the initial checkout to work that
>> way if the rest of rebase (and the checkout for the am backend)
>> ignores submodules? reset.c::reset_head() just uses unpack trees like
>> checkout so if rebase read 'submodule.recurse' then reset_head()
>> would work like 'git checkout' and also 'git rebase --abort' and the
>> "reset" command in the todo list would start checking out submodules.

it would also affect fast-forwards

>> I'm reluctant to do that until the merge backend also handles
>> submodules unless there is a good reason that such partial submodule
>> support would help submodule users.
> 
> Yeah, it's not that useful, I have to admit; it can also be very confusing
> since some parts of rebase are affected, and some not. For example, any 
> time
> the rebase stops, like for 'edit', 'break', and when there are 
> conflicts, the
> submodules are not updated. So I think a full solution is better than a 
> partial
> solution; in the meantime I'm thinking the change you are proposing 
> would actually
> be less confusing, even if it slightly changes behaviour...
> 
> As an aside, I *think* reading submodule.recurse in rebase like it's 
> done in checkout
> et al., i.e. something like this:
> 
> diff --git a/builtin/rebase.c b/builtin/rebase.c
> index 33e0961900..125ec907e4 100644
> --- a/builtin/rebase.c
> +++ b/builtin/rebase.c
> @@ -26,6 +26,7 @@
>   #include "rerere.h"
>   #include "branch.h"
>   #include "sequencer.h"
> +#include "submodule.h"
>   #include "rebase-interactive.h"
>   #include "reset.h"
> 
> @@ -1106,6 +1107,9 @@ static int rebase_config(const char *var, const 
> char *value, void *data)
>           return git_config_string(&opts->default_backend, var, value);
>       }
> 
> +    if (!strcmp(var, "submodule.recurse"))
> +        return git_default_submodule_config(var, value, data);

That looks about right to me though I think it would be safer to call 
git_default_submodule_config() for submodule.* rather than just 
submodule.recurse

>       return git_default_config(var, value, data);
>   }
> 
> 
> would actually also affect the merges
> performed during the rebase, since that would affect the "global" state 
> in submodule.c.
> I hacked exactly that the other day but did not test extensively...

merge-ort.c:checkout() which is used by merge_switch_to_result() uses 
unpack_trees() so it will pick up the global state and hopefully should 
just work (cc'ing Elijah to check as I didn't look what happens when 
there are conflicts). merge-recursive.c:update_file_flags() does this 
when updating the work tree

        if (S_ISGITLINK(contents->mode)) { 

                 /* 

                  * We may later decide to recursively descend into 

                  * the submodule directory and update its index 

                  * and/or work tree, but we do not do that now. 

                  */ 

                 update_wd = 0; 

                 goto update_index; 

        } 

 

so it looks like it does not update the submodule directory. Given 
merge-ort is now the default perhaps it's time for rebase (and 
cherry-pick/revert) to start reading the submodule config settings (we 
parse the config before we know if we'll be using merge-ort so I don't 
know how easy it would be to only parse the submodule settings if we are 
using merge-ort).

Best Wishes

Phillip

  reply	other threads:[~2021-09-09 14:39 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-08 13:41 [PATCH 0/5] rebase -i: a couple of small improvements Phillip Wood via GitGitGadget
2021-09-08 13:41 ` [PATCH 1/5] sequencer.c: factor out a function Phillip Wood via GitGitGadget
2021-09-08 17:51   ` Eric Sunshine
2021-09-09 10:10     ` Phillip Wood
2021-09-09 10:44   ` Johannes Schindelin
2021-09-08 13:41 ` [PATCH 2/5] rebase: fix todo-list rereading Phillip Wood via GitGitGadget
2021-09-09 10:48   ` Johannes Schindelin
2021-09-08 13:41 ` [PATCH 3/5] reset_head(): mark oid parameter as const Phillip Wood via GitGitGadget
2021-09-08 13:41 ` [PATCH 4/5] rebase -i: don't fork git checkout Phillip Wood via GitGitGadget
2021-09-08 18:14   ` Philippe Blain
2021-09-09 10:09     ` Phillip Wood
2021-09-09 12:40       ` Philippe Blain
2021-09-09 13:57         ` Phillip Wood [this message]
2021-09-09 15:01           ` Elijah Newren
2021-09-10 12:07             ` Philippe Blain
2021-09-15 15:44             ` Phillip Wood
2021-09-09 10:53     ` Johannes Schindelin
2021-09-09 12:44       ` Philippe Blain
2021-09-09 21:43         ` Johannes Schindelin
2021-09-10 10:46         ` Johannes Schindelin
2021-09-10 11:58           ` Philippe Blain
2021-09-09 15:03   ` Elijah Newren
2021-09-08 13:41 ` [PATCH 5/5] rebase: remove unused parameter Phillip Wood via GitGitGadget
2021-09-09 10:54   ` Johannes Schindelin
2021-09-09 14:04     ` Phillip Wood
2021-09-23 15:26 ` [PATCH v2 0/2] rebase -i: a couple of small improvements Phillip Wood via GitGitGadget
2021-09-23 15:26   ` [PATCH v2 1/2] sequencer.c: factor out a function Phillip Wood via GitGitGadget
2021-09-23 15:26   ` [PATCH v2 2/2] rebase: fix todo-list rereading Phillip Wood via GitGitGadget
2021-09-24 16:13     ` Junio C Hamano
2021-09-28 10:20       ` Phillip Wood
2021-09-24 19:24   ` [PATCH v2 0/2] rebase -i: a couple of small improvements Junio C Hamano

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=408dc1d3-44b8-a955-4d7b-94f23fa8a6bc@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=emilyshaffer@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=levraiphilippeblain@gmail.com \
    --cc=newren@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.