]> git.ipfire.org Git - thirdparty/git.git/commit
apply: integrate with the sparse index
authorDerrick Stolee <stolee@gmail.com>
Fri, 16 May 2025 14:55:27 +0000 (14:55 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 16 May 2025 19:00:33 +0000 (12:00 -0700)
commit952de281fe63eb03e0dcc8adf773ce54cb581b83
tree4aede59e2c9e265c61b57ff4e65434e8a3023397
parentd50a5e8939abfc07c2ff97ae72e9330939b36ee0
apply: integrate with the sparse index

The sparse index allows storing directory entries in the index, marked
with the skip-wortkree bit and pointing to a tree object. This may be an
unexpected data shape for some implementation areas, so we are rolling
it out incrementally on a builtin-per-builtin basis.

This change enables the sparse index for 'git apply'. The main
motivation for this change is that 'git apply' is used as a child
process of 'git add -p' and expanding the sparse index for each of those
child processes can lead to significant performance issues.

The good news is that the actual index manipulation code used by 'git
apply' is already integrated with the sparse index, so the only product
change is to mark the builtin as allowing the sparse index so it isn't
inflated on read.

The more involved part of this change is around adding tests that verify
how 'git apply' behaves in a sparse-checkout environment and whether or
not the index expands in certain operations.

Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/apply.c
t/t1092-sparse-checkout-compatibility.sh