Merge branch 'nd/switch-and-restore'

"git restore --staged" did not correctly update the cache-tree
structure, resulting in bogus trees to be written afterwards, which
has been corrected.

* nd/switch-and-restore:
  restore: invalidate cache-tree when removing entries with --staged
This commit is contained in:
Junio C Hamano
2020-01-22 15:07:32 -08:00
2 changed files with 19 additions and 0 deletions

View File

@ -524,6 +524,8 @@ static int checkout_paths(const struct checkout_opts *opts,
/* Now we are committed to check them out */
if (opts->checkout_worktree)
errs |= checkout_worktree(opts);
else
remove_marked_cache_entries(&the_index, 1);
/*
* Allow updating the index when checking out from the index.