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

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.txt

I 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.
Previous: Jeff King
Message 5 of 5 in “Bug: magic-less pathspecs that start with ":" not processed as expected.”
  1. Joanna WangNov 6, 2023
  2. Jeff KingNov 6, 2023
  3. Junio C HamanoNov 6, 2023
  4. Jeff KingNov 7, 2023
  5. Junio C HamanoNov 6, 2023

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.