Jeff King [off-list ref] writes:
quoted hunk
diff --git a/builtin/checkout.c b/builtin/checkout.c
index b52c490c8f..18ef5fb975 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -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);
Ah, I was wondering why we were seeing breakages on cache-tree,
which is fairly old and stable part of the system---even though it
had caused us quite a lot of pain while it was growing---all of a
sudden. No wonder---this codepath is a fairly new one, introduced
when "restore" was added X-<.
And the fix looks right, of course. Thanks for extracting a
reproducible recipe out of the original reporter and quickly
diagnosing it. Very much appreciated.