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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff Hostetler committed May 26, 2022 at 21:47 UTC 9968ed73ff8bf00d06862e6653451faeb008afef
1 file changed +1
unpack-trees.c
+1
@@ -1772,6 +1772,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
1772
1773 o->result.fsmonitor_last_update =
1774 xstrdup_or_null(o->src_index->fsmonitor_last_update);
1775 + o->result.fsmonitor_has_run_once = o->src_index->fsmonitor_has_run_once;
1776
1777 /*
1778 * Sparse checkout loop #1: set NEW_SKIP_WORKTREE on existing entries