]> git.ipfire.org Git - thirdparty/git.git/commit
reset: make sparse-aware (except --mixed)
authorVictoria Dye <vdye@github.com>
Mon, 29 Nov 2021 15:52:41 +0000 (15:52 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 29 Nov 2021 20:51:26 +0000 (12:51 -0800)
commit20ec2d034cda1afef15a4dcc6e275d7a69413510
tree1461ef3b8acc4895f8e31ded1d9674c8fb0a7318
parentc01b1cbd473c05e29fe0c1a31b8f6539e82c4559
reset: make sparse-aware (except --mixed)

Remove `ensure_full_index` guard on `prime_cache_tree` and update
`prime_cache_tree_rec` to correctly reconstruct sparse directory entries in
the cache tree. While processing a tree's entries, `prime_cache_tree_rec`
must determine whether a directory entry is sparse or not by searching for
it in the index (*without* expanding the index). If a matching sparse
directory index entry is found, no subtrees are added to the cache tree
entry and the entry count is set to 1 (representing the sparse directory
itself). Otherwise, the tree is assumed to not be sparse and its subtrees
are recursively added to the cache tree.

Helped-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache-tree.c
cache.h
read-cache.c
t/t1092-sparse-checkout-compatibility.sh