# [bug] incorrect pathspec handling in git stash error message

1 messages from 2024-11-29 to 2024-11-29. Participants: Tamas Dina.
Thread: https://gitlist.dev/t/62564

## Tamas Dina, 2024-11-29 11:46

Subject: [bug] incorrect pathspec handling in git stash error message
Message-ID: <CAMZfs4Vfi4OfuO3=7yT=ge7MHXf1iPhZjeJSzgnr=9oQFiRKjg@mail.gmail.com>
URL: https://gitlist.dev/e/CAMZfs4Vfi4OfuO3%3D7yT%3Dge7MHXf1iPhZjeJSzgnr%3D9oQFiRKjg%40mail.gmail.com

```
=====
===== What did you do before the bug happened? (Steps to reproduce your issue)
=====
Here is how to reproduce the issue from scratch:
1. mkdir testrepo
2. cd testrepo
3. git init
4. touch testfile
5. git stash push testfile

=====
===== What did you expect to happen? (Expected behavior)
=====
Because 'testfile' is untracked, I expected an error message similar to this:
    testrepo $ git checkout testfile
    error: pathspec 'testfile' did not match any file(s) known to git

=====
===== What happened instead? (Actual behavior)
=====
This is what happens instead:
    testrepo $ git stash push testfile
    error: pathspec ':(prefix:0)testfile' did not match any file(s) known to git
    Did you forget to 'git add'?

=====
===== What's different between what you expected and what actually happened?
=====
Looks like the magic prefix is handled incorrectly in git stash error messages.

=========================
=========================
[System Info]
git version:
git version 2.47.1
cpu: arm64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
libcurl: 8.6.0
zlib: 1.2.12
uname: Darwin 23.6.0 Darwin Kernel Version 23.6.0: Thu Sep 12 23:34:49 PDT 2024
compiler info: clang: 16.0.0 (clang-1600.0.26.4)
libc info: no libc information available
$SHELL (typically, interactive shell): /bin/zsh
=========================
=========================

```
