git-log--graph icon indicating copy to clipboard operation
git-log--graph copied to clipboard

Selecting a stash throws an unexpected error

Open buddybu opened this issue 1 year ago • 5 comments

Selecting a stash (without a description), throws an error:

GitLG: An unexpected error happened. Error summary: {"error_response":"usage: git stash show [<options>] [<stash>]\n\n\n","request":{"command":"git","data":"-c core.quotepath=false stash show --include-untracked --numstat --summary --format=\"\" 8fb1d953a","id":47,"type":"request-from-web"}}

https://vuejs.org/error-reference/#runtime-3. For details, see VSCode developer tools console. Please consider reporting this error.

I am using v0.1.21 of the extension in Ubuntu 22.04 VSCode version

Version: 1.94.2
Commit: 384ff7382de624fb94dbaf6da11977bba1ecd427
Date: 2024-10-09T16:08:44.566Z
Electron: 30.5.1
ElectronBuildId: 10262041
Chromium: 124.0.6367.243
Node.js: 20.16.0
V8: 12.4.254.20-electron.0
OS: Linux x64 6.8.0-45-generic

Please let me know what other information I can provide.

buddybu avatar Oct 15 '24 22:10 buddybu

Additionally I am running within a Remove Devcontainer. My git version is 2.30.2. From what I can tell from the command line being displayed, git does not like the parameter --include-untracked.

buddybu avatar Oct 15 '24 22:10 buddybu

Hi! This is the first time I'm hearing of this problem.

Git v2.30.2 is 3.5 years old: https://github.com/git/git/commits/master/Documentation/RelNotes/2.30.2.txt

The version shipped with Ubuntu 22.04 is 2.34.1 https://launchpad.net/ubuntu/jammy/+source/git, 3 years old: https://github.com/git/git/blob/master/Documentation/RelNotes/2.34.1.txt

Option --include-untracked however was introduced with version 1.7.8 https://github.com/git/git/commit/7f41b6bbe3181dc4d1687db036bf22316997a1bf#diff-42319772e8fb97d341d8f749aa5169a5183a700b8b8c394d2c4048bea51df82aR40 13 years ago.

So something's not right here. Can you please have another look? - copy and run the failing command git -c core.quotepath=false stash show --include-untracked --numstat --summary --format="" 8fb1d953a via command line, verify the Git version and figure out why it fails.

phil294 avatar Oct 20 '24 17:10 phil294

I am running in a VSCode remote dev-container, so it could be the base image of the docker container. It is currently debian:bullseye. I will work wiith the maintainer of the container and see if we can't upgrade it to debian:latest.

Git version output from the docker container.

> git --version
git version 2.30.2

But on the docker container, in the same folder, using the version 2.30.2 of git, I get:

> git -c core.quotepath=false stash show --include-untracked --numstat --summary --format="" 8fb1d953a
usage: git stash show [<options>] [<stash>]

On the host OS, git is version 2.34.1 and the command you asked me to run worked great.

> git -c core.quotepath=false stash show --include-untracked --numstat --summary --format="" 8fb1d953a
61      0       utils/dlopen_test/CMakeLists.txt
122     0       utils/dlopen_test/dlopen_test.c
 create mode 100644 utils/dlopen_test/CMakeLists.txt
 create mode 100644 utils/dlopen_test/dlopen_test.c

buddybu avatar Oct 21 '24 14:10 buddybu

Just want to close the loop on this issue (since I also ran into this recently):

While the --include-untracked option for git stash was indeed introduced in version 1.7.8, that option was not introduced for git stash show until version 2.32.0 https://github.com/git/git/commit/142430338477d9d1bb25be66267225fb58498d92 (released June 6th, 2021).

https://github.com/git/git/blob/master/Documentation/RelNotes/2.32.0.adoc

We can also verify this informally by comparing the git-stash man pages for 2.31.0 vs 2.32.0:

  • https://git-scm.com/docs/git-stash/2.31.0
  • https://git-scm.com/docs/git-stash/2.32.0

So the error is "just" due to the git version being too old - you need to use git version 2.32.0 or later in order to avoid the error.

rkimura-wheelsup avatar Apr 23 '25 03:04 rkimura-wheelsup

right, thanks @rkimura-wheelsup, that's valuable information. I think we should support Git a bit older than just 2021, so the command needs to be changed to something else after all.

phil294 avatar Apr 23 '25 18:04 phil294