status: skip sparse-checkout percentage with sparse-index
authorDerrick Stolee <dstolee@microsoft.com>
Fri, 21 May 2021 11:59:38 +0000 (11:59 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sat, 22 May 2021 08:58:19 +0000 (17:58 +0900)
commit214beb8a79796cc99e2367b71c171e171b7a007e
tree158c6ba5347a076527dc4769d769b1f1fb30cb8d
parent70c088977e699e2505ad771f78973a352c4a4d37
status: skip sparse-checkout percentage with sparse-index

'git status' began reporting a percentage of populated paths when
sparse-checkout is enabled in 051df3cf (wt-status: show sparse
checkout status as well, 2020-07-18). This percentage is incorrect when
the index has sparse directories. It would also be expensive to
calculate as we would need to parse trees to count the total number of
possible paths.

Avoid the expensive computation by simplifying the output to only report
that a sparse checkout exists, without the percentage.

This change is the reason we use 'git status --porcelain=v2' in
t1092-sparse-checkout-compatibility.sh. We don't want to ensure that
this message is equal across both modes, but instead just the important
information about staged, modified, and untracked files are compared.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t1092-sparse-checkout-compatibility.sh
wt-status.c
wt-status.h