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

[bug] incorrect pathspec handling in git stash error message

From
TDTamas Dina <dinatamaspal.throwaway1@gmail.com>
Date
Nov 29, 2024, 11:46 UTC
Message-ID
<CAMZfs4Vfi4OfuO3=7yT=ge7MHXf1iPhZjeJSzgnr=9oQFiRKjg@mail.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 ========================= =========================

Message 1 of 1 in “[bug] incorrect pathspec handling in git stash error message”
  1. Tamas DinaNov 29, 2024

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.