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

Bug: magic-less pathspecs that start with ":" not processed as expected.

From
Joanna Wang <jojwang@google.com>
Date
Nov 6, 2023, 15:54 UTC
Message-ID
<CAMmZTi-JJ6=Uw_+r50hKMYf34D0NtqXhaA=f+11+wAQBjqA7_g@mail.gmail.com>
What did you do before the bug happened? (Steps to reproduce your issue)

What did you expect to happen? (Expected behavior) `git stash push -- :file` where `:` is part of the filename, should search for files named ":file"

What happened instead? (Actual behavior) The match string used to find files is "file" without the ":".

What's different between what you expected and what actually happened? file named ":file" is not found.

Anything else you want to add: 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.

I could not find any documentation that says ":" is a reserved character to indicate pathspec magic symbols MUST follow or that ":file" is not a valid file name.

[System Info] git version 2.42.0 cpu: x86_64 no commit associated with this build shell-path: /bin/sh

[Enabled Hooks] not run from a git repository - no hooks to show

Next: Jeff King
Message 1 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.