git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] restore: invalidate cache-tree when removing entries with --staged

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 8, 2020, 15:41 UTC
Message-ID
<xmqq4kx63qh8.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20200108114344.GA3380580@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 10 quoted lines
> 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.

Previous: Jeff KingNext: Dennis Kaarsemaker
Message 9 of 13 in “Broken branch after git commit - tracked files in staging area can't be removed with restore --staged, or commit or stash”
  1. Torsten KrahJan 7, 2020
  2. Torsten KrahJan 7, 2020
  3. Torsten KrahJan 7, 2020
  4. Jeff KingJan 8, 2020
  5. Torsten KrahJan 8, 2020
  6. Torsten KrahJan 8, 2020
  7. Jeff KingJan 8, 2020
  8. restore: invalidate cache-tree when removing entries with --stagedJeff King, Jan 8, 2020
  9. Junio C HamanoJan 8, 2020
  10. Dennis KaarsemakerFeb 5, 2020
  11. Torsten KrahJan 8, 2020
  12. Jeff KingJan 9, 2020
  13. Torsten KrahJan 9, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.