rebase --update-refs: fix loops

The `total_nr` field in the `todo_list` structure merely serves display purposes, and should only be used when generating the progress message. In these two instances, however, we want to loop over all of the commands in the parsed rebase script. The loop limit therefore needs to be `nr`, which refers to the count of commands in the current `todo_list`. This is important because the two numbers, `nr` and `total_nr` can differ wildly, e.g. due to `total_nr` _not_ counting comments or empty lines, while `nr` skips any commands that already moved from the `git-rebase-todo` file to the `done` file. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Acked-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed May 13, 2023 at 08:11 UTC fa5103dd8913366b031ad8daa11f27e9452638be
1 file changed +2 -2
sequencer.c
+2 -2
@@ -4205,7 +4205,7 @@ void todo_list_filter_update_refs(struct repository *r,
4205 if (!is_null_oid(&rec->after))
4206 continue;
4207
4208 - for (j = 0; !found && j < todo_list->total_nr; j++) {
4208 + for (j = 0; !found && j < todo_list->nr; j++) {
4209 struct todo_item *item = &todo_list->items[j];
4210 const char *arg = todo_list->buf.buf + item->arg_offset;
4211
@@ -4235,7 +4235,7 @@ void todo_list_filter_update_refs(struct repository *r,
4235 * For each todo_item, check if its ref is in the update_refs list.
4236 * If not, then add it as an un-updated ref.
4237 */
4238 - for (i = 0; i < todo_list->total_nr; i++) {
4238 + for (i = 0; i < todo_list->nr; i++) {
4239 struct todo_item *item = &todo_list->items[i];
4240 const char *arg = todo_list->buf.buf + item->arg_offset;
4241 int j, found = 0;