threads / discuss / 57833

Support -- pathspec in git-stash show command

Subject: Support -- pathspec in git-stash show command

## tl;dr

One message between May 2, 2022 and May 2, 2022.

replies: 0people: 1as markdown or json

Erik Aigner· May 2, 2022, 16:01 UTC · lore

Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)
1) Create a stash containing multiple files including `foo/bar.txt`
2) perform `git stash show -p stash@{0} -- foo/bar.txt
What did you expect to happen? (Expected behavior)
The stash patch output would be limited to only the provided pathspec `foo/bar.txt`
What happened instead? (Actual behavior)
Error message "Too many revisions specified: 'stash@{0}' 'test/foo.txt'"
What's different between what you expected and what actually happened?

The manpage for git-stash states that the SHOW command should support any argument the git-diff command also accepts, but apparently the trailing "-- <pathspec>" does not work with "git stash show".

Anything else you want to add:

For symmetry with git-diff, git-show should also support a pathspec parameter. The reason for this is that `git stash show` has the stash specific `--include-untracked` paramenter, which git-diff doesn't have.

Please review the rest of the bug report below. You can delete any lines you don't wish to share.

[System Info] git version: git version 2.32.0 (Apple Git-132) cpu: arm64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Darwin 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:47:26 PDT 2022; root:xnu-8020.101.4~15/RELEASE_ARM64_T8101 arm64 compiler info: clang: 13.1.6 (clang-1316.0.21.2.3) libc info: no libc information available $SHELL (typically, interactive shell): /bin/zsh

[Enabled Hooks] pre-commit

← back to recent threads