From: Phillip Wood Date: Thu, 21 Mar 2019 14:35:12 GMT Subject: Re: [RFC PATCH 01/11] sequencer: always discard index after checkout Message-ID: <8c663552-b792-b885-ea59-abe3137efe26@gmail.com> In-Reply-To: On 20/03/2019 01:50, Duy Nguyen wrote: > On Wed, Mar 20, 2019 at 2:04 AM Phillip Wood wrote: >> It would perhaps be better to pass around the_index rather than >> the_repository > > Not by a large margin. For sequencer.c most operations require more > than just the index and passing 'struct repository *' around has been > the norm. And as soon as you need to load the index back (not sure if > you should do it here btw, after discard_index, since we have the > index loaded before) you need 'struct repository' not 'struct > index_state'. Thanks, I think I'll leave it as it is then. After we checkout the new base we reload the index in the loop that picks the commits. For 'rebase ' after we checkout we create the todo-list which involves a revision walk and then checkout the new base. I'm not entirely sure if it needs reloading before we create the todo list but I think it probably not as I don't think rebase--interactive.c loads the index (which would explain why this only becomes an issue when we stop forking rebase--interactive from rebase because then rebase.c has loaded the index to check there are no uncommitted changes) Best Wishes Phillip > >> builtin/rebase--interactive.c | 2 +- >> sequencer.c | 27 +++++++++++++++++---------- >> sequencer.h | 3 ++- >> 3 files changed, 20 insertions(+), 12 deletions(-)