threads / bug / 59133

[BUG] `git stash` exits without output when lockfile present

Subject: [BUG] `git stash` exits without output when lockfile present

## tl;dr

One message between Jan 21, 2023 and Jan 21, 2023.

replies: 0people: 1as markdown or json

Keith Layne· Jan 21, 2023, 18:07 UTC · lore
What did you do before the bug happened? (Steps to reproduce your issue)
In clean repo root:

$ touch foo $ touch .git/index.lock $ git stash

What did you expect to happen? (Expected behavior)
An error message to stderr explaining that .git/index.lock exists, etc.
What happened instead? (Actual behavior)
`git stash` has an exit code of 1, with no output on stdout or stderr.
What's different between what you expected and what actually happened?

I didn't notice at first that the stash failed, and I was briefly confused. I guess I've never tried to stash and gotten this error before, but whenever I see the "lockfile exists" error I feel like the UX is very consistent with other commands. I expected stash to work the same way.

I apologize if this is a dupe, I don't know how to search the archives.

[System Info] git version: git version 2.34.1 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Linux 5.19.16-76051916-generic #202210150742~1666053244~22.04~cf07008 SMP PREEMPT_DYNAMIC Tue O x86_64 compiler info: gnuc: 11.2 libc info: glibc: 2.35 $SHELL (typically, interactive shell): /bin/zsh

[Enabled Hooks]

← back to recent threads