Hi, Le 18/07/2019 à 21:55, Junio C Hamano a écrit : > Alban Gruin <alban.gruin@xxxxxxxxx> writes: > > In a todo list, `done_nr' is the amount of commands that were executed > > or skipped, but skip_unnecessary_picks() did not update it. > > OK. Together with 3/9 and this one, any increment of total_nr and > done_nr in the existing code is not removed; does it mean that > nobody actually cares what these fields contain? IOW, there is no > code that says "if (list->total_nr <= i) { we are done; }" etc.? > > Or are these fields used later, but somehow the lack of increment in > the places touched by 3/9 and 4/9 is compensated? > `total_nr' is not used for this, because it’s not necessarily the number of items in the todo list. That’s the role of `nr'. So the comparison is more like "if (list->nr <= i) { we are done; }". Same think for `done_nr'. Each time a command is executed, git prints "Rebasing ($done_nr/$total_nr)". These two variables are written to the disk, and might be used by a shell prompt (eg. git-prompt.sh, oh my zsh…) And this is actually how I found this. Originally, I wrote what became 5/9 and 6/9, without touching to `done_nr' and `total_nr'. All rebase tests (t34??*) passed, but t9903.15 ("prompt - rebase merge") failed, because the value was incorrect. The reason is that, before I changed sequencer_continue() in 6/9, it called another function, read_populate_todo(), which would recompute `done_nr' and `total_nr', then write them to the disk. With my changes, these values would not have been updated after adding `exec' commands or skipping picks in complete_action(), so the numbers written to the disk were incorrect. tl;dr: it does not impact how the rebase works, but it might impact the messages printed while rebasing or shell prompts. > > Signed-off-by: Alban Gruin <alban.gruin@xxxxxxxxx> > > --- > > > > sequencer.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/sequencer.c b/sequencer.c > > index e61ae75451..ec9c3d4dc5 100644 > > --- a/sequencer.c > > +++ b/sequencer.c > > @@ -4939,6 +4939,7 @@ static int skip_unnecessary_picks(struct repository > > *r,> > > MOVE_ARRAY(todo_list->items, todo_list->items + i, todo_list->nr - i); > > todo_list->nr -= i; > > todo_list->current = 0; > > > > + todo_list->done_nr += i; > > > > if (is_fixup(peek_command(todo_list, 0))) > > > > record_in_rewritten(base_oid, peek_command(todo_list, 0));