]> git.ipfire.org Git - thirdparty/git.git/commit - unpack-trees.c
checkout: fix two bugs on the final count of updated entries
authorMatheus Tavares <matheus.bernardino@usp.br>
Thu, 14 Jul 2022 11:49:12 +0000 (08:49 -0300)
committerJunio C Hamano <gitster@pobox.com>
Thu, 14 Jul 2022 17:19:28 +0000 (10:19 -0700)
commit611c7785e8e22637e183333c54ed266e6e83e163
tree8b4379db400b8f61570306598567e03c4eab0eb3
parent11d14dee43794581ca3a7a93f9a081de711845d4
checkout: fix two bugs on the final count of updated entries

At the end of `git checkout <pathspec>`, we get a message informing how
many entries were updated in the working tree. However, this number can
be inaccurate for two reasons:

1) Delayed entries currently get counted twice.
2) Failed entries are included in the count.

The first problem happens because the counter is first incremented
before inserting the entry in the delayed checkout queue, and once again
when finish_delayed_checkout() calls checkout_entry(). And the second
happens because the counter is incremented too early in
checkout_entry(), before the entry was in fact checked out. Fix that by
moving the count increment further down in the call stack and removing
the duplicate increment on delayed entries. Note that we have to keep
a per-entry reference for the counter (both on parallel checkout and
delayed checkout) because not all entries are always accumulated at the
same counter. See checkout_worktree(), at builtin/checkout.c for an
example.

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/checkout.c
convert.h
entry.c
entry.h
parallel-checkout.c
parallel-checkout.h
t/t0021-conversion.sh
t/t2080-parallel-checkout-basics.sh
unpack-trees.c