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