sparse-checkout: add sanity-checks on initial sparsity state
commit45c5e47048a89e08a9e844bcf976401af8b60478
authorElijah Newren <newren@gmail.com>
Tue, 14 Dec 2021 04:09:05 +0000 (14 04:09 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 15 Dec 2021 19:48:21 +0000 (15 11:48 -0800)
tree8ff38c1c5ddd9b343ec3a99e0656f9b1edaa3cc9
parent0b624e039cc2c9e30333445e8c67002f41d63678
sparse-checkout: add sanity-checks on initial sparsity state

Most sparse-checkout subcommands (list, add, reapply) only make sense
when already in a sparse state.  Add a quick check that will error out
early if this is not the case.

Also document with a comment why we do not exit early in `disable` even
when core.sparseCheckout starts as false.

Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Reviewed-by: Victoria Dye <vdye@github.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/sparse-checkout.c
t/t1091-sparse-checkout-builtin.sh