summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorAlban Gruin <alban.gruin@gmail.com>2019-11-24 17:43:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-11-25 03:24:48 (GMT)
commit8638114e063f60fef678d51ca904da7c4e1ab3c0 (patch)
tree2505792cee2cd6112a90c553e1e5a0bf57f52943 /sequencer.c
parentbc12974a897308fd3254cf0cc90319078fe45eea (diff)
downloadgit-8638114e063f60fef678d51ca904da7c4e1ab3c0.zip
git-8638114e063f60fef678d51ca904da7c4e1ab3c0.tar.gz
git-8638114e063f60fef678d51ca904da7c4e1ab3c0.tar.bz2
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>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sequencer.c b/sequencer.c
index d648aaf..575b852 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++;
}