unpack-trees: initialize fsmonitor_has_run_once in o->result

Initialize `o->result.fsmonitor_has_run_once` based upon value
in `o->src_index->fsmonitor_has_run_once` to prevent a second
fsmonitor query during the tree traversal and possibly getting
a skewed view of the working directory.

The checkout code has already talked to the fsmonitor and the
traversal is updating the index as it traverses, so there is
no need to query the fsmonitor.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
This commit is contained in:
Jeff Hostetler
2021-08-23 17:42:28 -04:00
committed by Victoria Dye
parent 69c2a37de2
commit aa5d49b0f2

View File

@@ -1838,6 +1838,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
o->result.fsmonitor_last_update =
xstrdup_or_null(o->src_index->fsmonitor_last_update);
o->result.fsmonitor_has_run_once = o->src_index->fsmonitor_has_run_once;
/*
* Sparse checkout loop #1: set NEW_SKIP_WORKTREE on existing entries