Commit ad770c4
committed
sparse-index: mark am, mv, submodule, grep as sparse-index compatible
These commands were found to have never declared command_requires_full_index.
After analysis, all four are safe with sparse index (= 0).
git-am: The patch application path uses index_name_pos() which auto-expands
sparse directory entries on demand when a specific file path is looked up.
The three-way merge fallback uses merge-ort, which works from tree OIDs and
handles sparse directories natively. refresh_index() explicitly skips
S_ISSPARSEDIR entries. git-rebase --apply invokes git-am as a child
process; rebase itself already declares command_requires_full_index = 0.
git-mv: For in-cone moves, all index lookups use index_name_pos() on
paths that cannot be ancestors of sparse directory entries (by
definition of the sparse cone), so no expansion is triggered.
index_range_of_same_dir() iterates only in-cone entries in this case.
For out-of-cone moves (--sparse flag), a targeted ensure_full_index()
is needed because the bulk cache[] iteration and rename_index_entry_at()
assume individual file entries, not collapsed directory stubs.
git-submodule--helper: Submodule entries (S_ISGITLINK) are never collapsed
into sparse directory entries -- convert_to_sparse_rec() in sparse-index.c
explicitly blocks directories containing gitlinks from being collapsed.
module_list_compute() filters on S_ISGITLINK, skipping any sparse
directory entries. module_add() already calls ensure_full_index()
unconditionally before its index iteration.
grep (submodule path): grep_cache() explicitly handles S_ISSPARSEDIR
entries by reading the tree object and recursing via grep_tree(), so
sparse directory contents are grepped correctly. The subrepo index
is independent of the superproject.1 parent b6b4a96 commit ad770c4
4 files changed
Lines changed: 8 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2465 | 2465 | | |
2466 | 2466 | | |
2467 | 2467 | | |
2468 | | - | |
2469 | 2468 | | |
2470 | | - | |
| 2469 | + | |
2471 | 2470 | | |
2472 | 2471 | | |
2473 | 2472 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
500 | 500 | | |
501 | 501 | | |
502 | 502 | | |
503 | | - | |
504 | 503 | | |
505 | | - | |
| 504 | + | |
506 | 505 | | |
507 | 506 | | |
508 | 507 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
248 | 249 | | |
249 | 250 | | |
250 | 251 | | |
251 | | - | |
252 | 252 | | |
253 | | - | |
| 253 | + | |
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
259 | 262 | | |
260 | 263 | | |
261 | 264 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3833 | 3833 | | |
3834 | 3834 | | |
3835 | 3835 | | |
3836 | | - | |
3837 | 3836 | | |
3838 | | - | |
| 3837 | + | |
3839 | 3838 | | |
3840 | 3839 | | |
3841 | 3840 | | |
0 commit comments