Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2023-05-13 11:11:25 +0300
committerJunio C Hamano <gitster@pobox.com>2023-05-15 07:44:50 +0300
commitfa5103dd8913366b031ad8daa11f27e9452638be (patch)
tree49739a887493b22929e19a7487ce18654dd7e3c8 /sequencer.c
parentec583449067bab5b800ecc63926f35c9dae96fa1 (diff)
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>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sequencer.c b/sequencer.c
index 0cf3842201..0101a72701 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -4205,7 +4205,7 @@ void todo_list_filter_update_refs(struct repository *r,
if (!is_null_oid(&rec->after))
continue;
- for (j = 0; !found && j < todo_list->total_nr; j++) {
+ for (j = 0; !found && j < todo_list->nr; j++) {
struct todo_item *item = &todo_list->items[j];
const char *arg = todo_list->buf.buf + item->arg_offset;
@@ -4235,7 +4235,7 @@ void todo_list_filter_update_refs(struct repository *r,
* For each todo_item, check if its ref is in the update_refs list.
* If not, then add it as an un-updated ref.
*/
- for (i = 0; i < todo_list->total_nr; i++) {
+ for (i = 0; i < todo_list->nr; i++) {
struct todo_item *item = &todo_list->items[i];
const char *arg = todo_list->buf.buf + item->arg_offset;
int j, found = 0;