Re: Bug: magic-less pathspecs that start with ":" not processed as expected.
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 6, 2023, 23:25 UTC
- Message-ID
- <xmqqlebacvn3.fsf@gitster.g>
- In-Reply-To
- <CAMmZTi-JJ6=Uw_+r50hKMYf34D0NtqXhaA=f+11+wAQBjqA7_g@mail.gmail.com>
Joanna Wang <jojwang@google.com> writes:
> I believe this is due to parse_short_magic() not handling the case where > ":" is part of the file name rather than a prefix for pathspec magic.
Also, ":<path>" is a notation for the object name sitting at <path> in the index, so giving it from the command line is ambiguous, too. I thought that ./:<path> would be a common way to talk about such a path to git commands?
$ date >./:now.txt
$ git add ./:now.txt
$ git rm ./:now.txtI do not offhand remember where this is documented, but I agree that we need to make sure that we give help to users on things like this ("how do I add a file whose name begins with a dash" is another question I think we hear from time to time).
Thanks.