Skip to content

Show an error when stashing with only untracked files present - #6013

Closed
voidstackloop wants to merge 1 commit into
jesseduffield:masterfrom
voidstackloop:fix-stash-untracked-only-error
Closed

voidstackloop wants to merge 1 commit into
jesseduffield:masterfrom
voidstackloop:fix-stash-untracked-only-error

Conversation

@voidstackloop

Copy link
Copy Markdown

Pressing s (Files.StashAllChanges) called git stash push directly with no guard, unlike every option in the Stash options menu, which first checks IsWorkingTreeDirtyExceptSubmodules() and shows NoFilesToStash otherwise.

Plain git stash push ignores untracked files by default, so with only an untracked file selected, git succeeds having stashed nothing (exit 0, no local changes to save), and lazygit's prompt just closes with no feedback (#5883).

Add the same guard already used by the equivalent menu item, and add an integration test covering it.

PR Description

Please check if the PR fulfills these requirements

  • Cheatsheets are up-to-date (run go generate ./...)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (see here)
  • If a new UserConfig entry was added, make sure it can be hot-reloaded (see here)
  • Docs have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

Pressing s (Files.StashAllChanges) called git stash push directly
with no guard, unlike every option in the Stash options menu, which
first checks IsWorkingTreeDirtyExceptSubmodules() and shows
NoFilesToStash otherwise.

Plain git stash push ignores untracked files by default, so with only
an untracked file selected, git succeeds having stashed nothing (exit
0, no local changes to save), and lazygit's prompt just closes with no
feedback (jesseduffield#5883).

Add the same guard already used by the equivalent menu item, and add
an integration test covering it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants