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

Re: Possible bug with git restore

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 22, 2020, 19:36 UTC
Message-ID
<xmqq364e79sm.fsf@gitster.c.googlers.com>
In-Reply-To
<20200820182720.GA2537643@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 14 quoted lines
> So I think this inconsistency in pathspec matching between trees and the
> index has probably existed in git-checkout for ages (and I guess people
> don't do wildcards with trees often enough for anybody to have noticed).
> But it didn't cause the index-deletion problem, because that only
> appeared more recently with the --no-overlay mode. That's the default
> for restore, but you can trigger the problem with checkout, too:
>
>   $ git reset --hard
>   $ git checkout --no-overlay HEAD^ '*.hpp'
>   Updated 0 paths from 2668463
>   $ git status
>   On branch master
>   Changes to be committed:
> 	deleted:    incl/test_file.hpp

The --no-overlay mode is an enhancement added on top of reasonably aged codebase relatively recently. Most of the core code in checkout dates back to early 2008, while --no-overlay was done as a long-overdue-afterthought in early last year.

And it is not all that surprising that this issue took a long time to be discovered.

Thank you all for finding, analysing and fixing it promptly.
Previous: Jeff King
Message 11 of 11 in “Possible bug with git restore”
  1. Sergii ShkarnikovAug 12, 2020
  2. Eric SunshineAug 14, 2020
  3. Sergii ShkarnikovAug 20, 2020
  4. Jeff KingAug 20, 2020
  5. René ScharfeAug 20, 2020
  6. Jeff KingAug 20, 2020
  7. checkout, restore: make pathspec recursiveRené Scharfe, Aug 22, 2020
  8. Jeff KingAug 24, 2020
  9. René ScharfeAug 22, 2020
  10. Jeff KingAug 24, 2020
  11. Junio C HamanoAug 22, 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.