Commit bc9adea
mv: integrate with sparse-index
Teach 'git mv' to work with a sparse index without expanding it for
in-cone file moves.
Set command_requires_full_index to 0 so that the sparse index is
preserved when reading. For --sparse operations that reference
out-of-cone paths, expand the full index immediately since those
operations need access to individual file entries within sparse
directory entries.
For in-cone moves, the entries are already individual in the sparse
index, so no expansion is needed. This provides a performance benefit
for the common case of renaming files within the working directory.
Update empty_dir_has_sparse_contents() to use index_name_pos_sparse()
(which avoids triggering expansion) and to recognize sparse directory
entries directly via S_ISSPARSEDIR, in addition to the existing logic
that finds individual skip-worktree entries beneath a directory prefix.
Signed-off-by: Derrick Stolee <stolee@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent d0242bf commit bc9adea
2 files changed
Lines changed: 37 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
149 | 151 | | |
150 | 152 | | |
151 | 153 | | |
152 | | - | |
| 154 | + | |
153 | 155 | | |
154 | 156 | | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
| 157 | + | |
| 158 | + | |
159 | 159 | | |
160 | | - | |
161 | | - | |
162 | | - | |
| 160 | + | |
163 | 161 | | |
| 162 | + | |
164 | 163 | | |
165 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
166 | 174 | | |
167 | 175 | | |
168 | 176 | | |
| |||
241 | 249 | | |
242 | 250 | | |
243 | 251 | | |
| 252 | + | |
| 253 | + | |
244 | 254 | | |
245 | 255 | | |
246 | 256 | | |
| |||
251 | 261 | | |
252 | 262 | | |
253 | 263 | | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
254 | 274 | | |
255 | 275 | | |
256 | 276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2876 | 2876 | | |
2877 | 2877 | | |
2878 | 2878 | | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
2879 | 2888 | | |
2880 | 2889 | | |
2881 | 2890 | | |
| |||
0 commit comments