]> git.ipfire.org Git - thirdparty/git.git/commit
checkout-index: integrate with sparse index
authorVictoria Dye <vdye@github.com>
Tue, 11 Jan 2022 18:05:03 +0000 (18:05 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 13 Jan 2022 21:49:45 +0000 (13:49 -0800)
commit35682ada44554e136677649ac3da8c92342cdae2
treea170aaa8b6a2a3d88deb62bd83e5c13ddea72bc6
parent88078f543b769dc13ae9796372651178584a25a0
checkout-index: integrate with sparse index

Add repository settings to allow usage of the sparse index.

When using the `--all` option, sparse directories are ignored by default due
to the `skip-worktree` flag, so there is no need to expand the index. If
`--ignore-skip-worktree-bits` is specified, the index is expanded in order
to check out all files.

When checking out individual files, existing behavior in a full index is to
exit with an error if a directory is specified (as the directory name will
not match an index entry). However, it is possible in a sparse index to
match a directory name to a sparse directory index entry, but checking out
that sparse directory still results in an error on checkout. To reduce some
potential confusion for users, `checkout_file(...)` explicitly exits with an
informative error if provided with a sparse directory name. The test
corresponding to this scenario verifies the error message, which now differs
between sparse index and non-sparse index checkouts.

Signed-off-by: Victoria Dye <vdye@github.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/checkout-index.c
t/t1092-sparse-checkout-compatibility.sh