Commit 0aeffe3
sparse-checkout: avoid writing entries with the skip-worktree bit
When using the sparse-checkout feature git should not write to the working
directory for files with the skip-worktree bit on. With the skip-worktree
bit on the file may or may not be in the working directory and if it is
not we don't want or need to create it by calling checkout_entry.
There are two callers of checkout_target. Both of which check that the
file does not exist before calling checkout_target. load_current which
make a call to lstat right before calling checkout_target and
check_preimage which will only run checkout_taret it stat_ret is less than
zero. It sets stat_ret to zero and only if !stat->cached will it lstat
the file and set stat_ret to something other than zero.
This patch checks if skip-worktree bit is on in checkout_target and just
returns so that the entry doesn't not end up in the working directory.
This is so that apply will not create a file in the working directory,
then update the index but not keep the working directory up to date with
the changes that happened in the index.
Signed-off-by: Kevin Willford <kewillf@microsoft.com>1 parent 137a953 commit 0aeffe3
1 file changed
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
3373 | 3374 | | |
3374 | 3375 | | |
3375 | 3376 | | |
| 3377 | + | |
| 3378 | + | |
| 3379 | + | |
| 3380 | + | |
| 3381 | + | |
| 3382 | + | |
| 3383 | + | |
| 3384 | + | |
| 3385 | + | |
| 3386 | + | |
| 3387 | + | |
| 3388 | + | |
| 3389 | + | |
| 3390 | + | |
| 3391 | + | |
| 3392 | + | |
| 3393 | + | |
| 3394 | + | |
| 3395 | + | |
3376 | 3396 | | |
3377 | 3397 | | |
3378 | 3398 | | |
| |||
0 commit comments