Skip to content

Commit 7b3a204

Browse files
kewillforddscho
authored andcommitted
fsmonitor: check CE_FSMONITOR_VALID in ce_uptodate
When using fsmonitor the CE_FSMONITOR_VALID flag should be checked when wanting to know if the entry has been updated. If the flag is set the entry should be considered up to date and the same as if the CE_UPTODATE is set. In order to trust the CE_FSMONITOR_VALID flag, the fsmonitor data needs to be refreshed when the fsmonitor bitmap is applied to the index in tweak_fsmonitor. Since the fsmonitor data is kept up to date for every command, some tests needed to be updated to take that into account. istate->untracked->use_fsmonitor was set in tweak_fsmonitor when the fsmonitor bitmap data was loaded and is now in refresh_fsmonitor since that is being called in tweak_fsmonitor. refresh_fsmonitor will only be called once and any other callers should be setting it when refreshing the fsmonitor data so that code can use the fsmonitor data when checking untracked files. When writing the index, fsmonitor_last_update is used to determine if the fsmonitor bitmap should be created and the extension data written to the index. When running through unpack-trees this is not copied to the result index. This makes the next time a git command is ran do all the work of lstating all files to determine what is clean since all entries in the index are marked as dirty since there wasn't any fsmonitor data saved in the index extension. Copying the fsmonitor_last_update to the result index will cause the extension data for fsmonitor to be in the index for the next git command to use. Signed-off-by: Kevin Willford <Kevin.Willford@microsoft.com>
1 parent 4080842 commit 7b3a204

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

read-cache-ll.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ static inline unsigned create_ce_flags(unsigned stage)
118118
#define ce_namelen(ce) ((ce)->ce_namelen)
119119
#define ce_size(ce) cache_entry_size(ce_namelen(ce))
120120
#define ce_stage(ce) ((CE_STAGEMASK & (ce)->ce_flags) >> CE_STAGESHIFT)
121-
#define ce_uptodate(ce) ((ce)->ce_flags & CE_UPTODATE)
121+
#define ce_uptodate(ce) (((ce)->ce_flags & CE_UPTODATE) || ((ce)->ce_flags & CE_FSMONITOR_VALID))
122122
#define ce_skip_worktree(ce) ((ce)->ce_flags & CE_SKIP_WORKTREE)
123123
#define ce_mark_uptodate(ce) ((ce)->ce_flags |= CE_UPTODATE)
124124
#define ce_intent_to_add(ce) ((ce)->ce_flags & CE_INTENT_TO_ADD)

0 commit comments

Comments
 (0)