diff options
| author | Derrick Stolee <stolee@gmail.com> | 2026-05-26 20:26:34 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-05-27 13:42:59 +0900 |
| commit | 105aacd072e41c55948d016b46f86f75db2487b3 (patch) | |
| tree | adc9720f503c7059c903d6b8b8175f3f7a1a4f32 /t/t4013/diff.diff_initial..side | |
| parent | ca7b9ae3403b1a46fffbdae312092c4029470eee (diff) | |
restore: avoid sparse index expansion
Teach update_some() to handle sparse directory entries at the tree
level rather than expanding the entire sparse index. When iterating a
source tree during checkout/restore operations:
- If a directory matches a sparse directory entry with the same OID,
skip it entirely (no change needed).
- If the OID differs and we are in non-overlay mode (e.g., restore
--staged), update the sparse directory entry's OID in place. This
is semantically correct because non-overlay mode removes paths not
in the source tree anyway.
- In overlay mode (e.g., checkout <tree> -- .), fall through to
recursive descent so individual file entries are preserved
correctly.
Also switch from index_name_pos() to index_name_pos_sparse() for
individual file lookups to avoid triggering ensure_full_index() when
the file is already individually tracked in the index.
Update the test expectation in t1092 to assert that 'restore --staged'
no longer expands the sparse index.
Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013/diff.diff_initial..side')
0 files changed, 0 insertions, 0 deletions
