aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlban Gruin <alban.gruin@gmail.com>2019-11-24 18:43:28 +0100
committerJunio C Hamano <gitster@pobox.com>2019-11-25 12:24:48 +0900
commit8638114e063f60fef678d51ca904da7c4e1ab3c0 (patch)
tree2505792cee2cd6112a90c553e1e5a0bf57f52943
parentbc12974a897308fd3254cf0cc90319078fe45eea (diff)
downloadgit-8638114e063f60fef678d51ca904da7c4e1ab3c0.tar.xz
sequencer: update `total_nr' when adding an item to a todo list
`total_nr' is the total number of items, counting both done and todo, that are in a todo list. But unlike `nr', it was not updated when an item was appended to the list. This variable is mostly used by command prompts (ie. git-prompt.sh and the like). By forgetting to update it, the original code made it not reflect the reality, but this flaw was masked by the code calling unnecessarily read_populate_todo() again to update the variable to its correct value. At the end of this series, the unnecessary call will be removed, and the inconsistency addressed by this patch would start to matter. Signed-off-by: Alban Gruin <alban.gruin@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--sequencer.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sequencer.c b/sequencer.c
index d648aaf416..575b852a5a 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -2070,6 +2070,7 @@ void todo_list_release(struct todo_list *todo_list)
static struct todo_item *append_new_todo(struct todo_list *todo_list)
{
ALLOC_GROW(todo_list->items, todo_list->nr + 1, todo_list->alloc);
+ todo_list->total_nr++;
return todo_list->items + todo_list->nr++;
}