]> git.ipfire.org Git - thirdparty/git.git/blobdiff - unpack-trees.c
Merge branch 'js/fsmonitor-unpack-fix'
[thirdparty/git.git] / unpack-trees.c
index f5f668f532d8d574735da064f4dfb5feb8c0cd95..9298fe1d9b3feb695f3ea6a36e0531e7399f3f23 100644 (file)
@@ -417,6 +417,9 @@ static int check_updates(struct unpack_trees_options *o,
 
        progress = get_progress(o, index);
 
+       /* Start with clean cache to avoid using any possibly outdated info. */
+       invalidate_lstat_cache();
+
        git_attr_set_direction(GIT_ATTR_CHECKOUT);
 
        if (should_update_submodules())
@@ -1609,8 +1612,8 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
        o->merge_size = len;
        mark_all_ce_unused(o->src_index);
 
-       if (o->src_index->fsmonitor_last_update)
-               o->result.fsmonitor_last_update = o->src_index->fsmonitor_last_update;
+       o->result.fsmonitor_last_update =
+               xstrdup_or_null(o->src_index->fsmonitor_last_update);
 
        /*
         * Sparse checkout loop #1: set NEW_SKIP_WORKTREE on existing entries