Merge branch 'fix-fsmonitor-crash'

This topic branch fixes a really hard-to-trigger corner case bug that
happened to me during one of those Git for Windows rebases.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2021-03-02 14:01:42 +01:00
2 changed files with 3 additions and 2 deletions

View File

@@ -2373,6 +2373,7 @@ int discard_index(struct index_state *istate)
cache_tree_free(&(istate->cache_tree));
istate->initialized = 0;
istate->fsmonitor_has_run_once = 0;
FREE_AND_NULL(istate->fsmonitor_last_update);
FREE_AND_NULL(istate->cache);
istate->cache_alloc = 0;
discard_split_index(istate);

View File

@@ -1612,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