Skip to content

Add confirmation dialogs for destructive workspace reset actions#5464

Open
TK88101 wants to merge 1 commit intojesseduffield:masterfrom
TK88101:add-confirmation-dialogs-destructive-actions
Open

Add confirmation dialogs for destructive workspace reset actions#5464
TK88101 wants to merge 1 commit intojesseduffield:masterfrom
TK88101:add-confirmation-dialogs-destructive-actions

Conversation

@TK88101
Copy link
Copy Markdown

@TK88101 TK88101 commented Apr 2, 2026

Summary

  • Add confirmation prompts before three destructive actions in the workspace reset menu that previously executed immediately without warning:
    • Discard unstaged changes (git checkout -- .)
    • Discard untracked files (git clean -fd)
    • Discard staged changes (stash staged and drop)
  • Update the discard_staged_changes integration test to handle the new confirmation dialog

Closes #874

Test plan

  • Build and run lazygit, open reset menu (Shift+D), verify confirmation dialogs appear for u, c, S options
  • Verify pressing Esc on confirmation cancels the action
  • Verify pressing Enter on confirmation executes the action
  • All existing integration tests pass (go test pkg/integration/clients/*.go)
  • All unit tests pass (go test ./pkg/gui/... ./pkg/i18n/...)

The workspace reset menu had several destructive actions that executed
immediately without confirmation, risking accidental data loss.

Add confirmation prompts before: discard unstaged changes (git checkout -- .),
discard untracked files (git clean -fd), and discard staged changes
(stash and drop). Update the existing integration test to expect the
new confirmation dialog.

Closes jesseduffield#874
@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 4 duplication

Metric Results
Complexity 0
Duplication 4

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

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.

Confirmation popup for destructive actions

1 participant