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.