-
Notifications
You must be signed in to change notification settings - Fork 106
Fix restore --staged
for certain vfs ops
#804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1852,6 +1852,25 @@ static void mark_new_skip_worktree(struct pattern_list *pl, | |
enable_fscache(istate->cache_nr); | ||
clear_ce_flags(istate, select_flag, skip_wt_flag, pl, show_progress); | ||
disable_fscache(); | ||
|
||
/* | ||
* 3. If clear_skip_worktree_for_added_entries is set and we are checking | ||
* for added entries, clear skip_wt_flag from all added entries. This is | ||
* used when running with virtualfilesystem to ensure that added entries are | ||
* also checked out in the working tree - otherwise skip_wt_flag will | ||
* prevent that. | ||
*/ | ||
if ((select_flag & CE_ADDED) | ||
&& istate->clear_skip_worktree_for_added_entries) { | ||
for (i = 0; i < istate->cache_nr; i++) { | ||
struct cache_entry *ce = istate->cache[i]; | ||
if ((ce->ce_flags & (CE_ADDED | skip_wt_flag)) | ||
== (CE_ADDED | skip_wt_flag)) { | ||
ce->ce_flags &= ~skip_wt_flag; | ||
istate->updated_skipworktree = 1; | ||
} | ||
} | ||
} | ||
Comment on lines
+1855
to
+1873
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So this new loop runs after the previous two loops over the entire index (even However, the virtual filesystem is already special-cased in Which makes me wonder whether it's that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll look into that. |
||
} | ||
|
||
static void populate_from_existing_patterns(struct unpack_trees_options *o, | ||
|
@@ -2004,6 +2023,8 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options | |
is_sparse_index_allowed(&o->internal.result, 0)) | ||
o->internal.result.sparse_index = 1; | ||
|
||
o->internal.result.clear_skip_worktree_for_added_entries = | ||
o->src_index->clear_skip_worktree_for_added_entries; | ||
/* | ||
* Sparse checkout loop #1: set NEW_SKIP_WORKTREE on existing entries | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's a good idea to remove these lines. Would the test be failing with the changes? That would be more indicative of a bug introduced by the changes, I think; The
post-index-change
hook is actively used in Office, and they use Scalar instead of VFSforGit, therefore virtual filesystem-specific changes should not affect them, I'd think.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
post-index-change
is still called by git checkout, but due to this change it is setting one of the arguments with less discrimination, and this test case is for scenarios where neither of the arguments are set.I will look into setting the argument more precisely so this test case will pass without change.