From 92f47d308f3f25f82915da95836db5cb8c1b68f1 Mon Sep 17 00:00:00 2001 From: Dhanush Shetty <154754292+dhanush0x96c@users.noreply.github.com> Date: Sun, 22 Mar 2026 22:51:55 +0530 Subject: [PATCH 1/3] Fix discard unstaged changes incorrectly requiring staged changes The "Discard unstaged changes" menu item was incorrectly disabled when no staged changes were present, even if unstaged changes existed. This change ensures it is only disabled when there are no unstaged changes. --- pkg/gui/controllers/files_controller.go | 2 +- pkg/i18n/english.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/gui/controllers/files_controller.go b/pkg/gui/controllers/files_controller.go index 8cc2ca5e2a6..7b0a24f5e9d 100644 --- a/pkg/gui/controllers/files_controller.go +++ b/pkg/gui/controllers/files_controller.go @@ -1517,7 +1517,7 @@ func (self *FilesController) remove(selectedNodes []*filetree.FileNode) error { ), } - if !someNodesHaveStagedChanges(selectedNodes) || !someNodesHaveUnstagedChanges(selectedNodes) { + if !someNodesHaveUnstagedChanges(selectedNodes) { discardUnstagedChangesItem.DisabledReason = &types.DisabledReason{Text: self.c.Tr.DiscardUnstagedDisabled} } diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 4c423c2bcbd..4dc2e2646c0 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -1323,7 +1323,7 @@ func EnglishTranslationSet() *TranslationSet { UndoMergeResolveTooltip: "Undo last merge conflict resolution.", DiscardAllTooltip: "Discard both staged and unstaged changes in '{{.path}}'.", DiscardUnstagedTooltip: "Discard unstaged changes in '{{.path}}'.", - DiscardUnstagedDisabled: "The selected items don't have both staged and unstaged changes.", + DiscardUnstagedDisabled: "The selected items don't have any unstaged changes.", Pop: "Pop", StashPopTooltip: "Apply the stash entry to your working directory and remove the stash entry.", Drop: "Drop", From 627e2dcd51f2e9db4634ee4157ab1ace789c0f9e Mon Sep 17 00:00:00 2001 From: Dhanush Shetty <154754292+dhanush0x96c@users.noreply.github.com> Date: Fri, 27 Mar 2026 22:49:28 +0530 Subject: [PATCH 2/3] Revert "Fix discard unstaged changes incorrectly requiring staged changes" This reverts commit 92f47d308f3f25f82915da95836db5cb8c1b68f1. --- pkg/gui/controllers/files_controller.go | 2 +- pkg/i18n/english.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/gui/controllers/files_controller.go b/pkg/gui/controllers/files_controller.go index 386cc2a6920..6686a7e9d71 100644 --- a/pkg/gui/controllers/files_controller.go +++ b/pkg/gui/controllers/files_controller.go @@ -1539,7 +1539,7 @@ func (self *FilesController) remove(selectedNodes []*filetree.FileNode) error { ), } - if !someNodesHaveUnstagedChanges(selectedNodes) { + if !someNodesHaveStagedChanges(selectedNodes) || !someNodesHaveUnstagedChanges(selectedNodes) { discardUnstagedChangesItem.DisabledReason = &types.DisabledReason{Text: self.c.Tr.DiscardUnstagedDisabled} } diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 4dc2e2646c0..4c423c2bcbd 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -1323,7 +1323,7 @@ func EnglishTranslationSet() *TranslationSet { UndoMergeResolveTooltip: "Undo last merge conflict resolution.", DiscardAllTooltip: "Discard both staged and unstaged changes in '{{.path}}'.", DiscardUnstagedTooltip: "Discard unstaged changes in '{{.path}}'.", - DiscardUnstagedDisabled: "The selected items don't have any unstaged changes.", + DiscardUnstagedDisabled: "The selected items don't have both staged and unstaged changes.", Pop: "Pop", StashPopTooltip: "Apply the stash entry to your working directory and remove the stash entry.", Drop: "Drop", From baf949d48e2107e002e1d90cad22cd75a2354fd0 Mon Sep 17 00:00:00 2001 From: Dhanush Shetty <154754292+dhanush0x96c@users.noreply.github.com> Date: Fri, 27 Mar 2026 23:12:58 +0530 Subject: [PATCH 3/3] Refine discard messaging and split disabled reasons for clarity --- pkg/gui/controllers/files_controller.go | 6 ++++-- pkg/i18n/english.go | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pkg/gui/controllers/files_controller.go b/pkg/gui/controllers/files_controller.go index 6686a7e9d71..cbd01b10101 100644 --- a/pkg/gui/controllers/files_controller.go +++ b/pkg/gui/controllers/files_controller.go @@ -1539,8 +1539,10 @@ func (self *FilesController) remove(selectedNodes []*filetree.FileNode) error { ), } - if !someNodesHaveStagedChanges(selectedNodes) || !someNodesHaveUnstagedChanges(selectedNodes) { - discardUnstagedChangesItem.DisabledReason = &types.DisabledReason{Text: self.c.Tr.DiscardUnstagedDisabled} + if !someNodesHaveUnstagedChanges(selectedNodes) { + discardUnstagedChangesItem.DisabledReason = &types.DisabledReason{Text: self.c.Tr.DiscardUnstagedDisabledNoUnstaged} + } else if !someNodesHaveStagedChanges(selectedNodes) { + discardUnstagedChangesItem.DisabledReason = &types.DisabledReason{Text: self.c.Tr.DiscardUnstagedDisabledNoStaged} } menuItems := []*types.MenuItem{ diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 4c423c2bcbd..d27fbb20abf 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -212,7 +212,8 @@ type TranslationSet struct { UndoMergeResolveTooltip string DiscardAllTooltip string DiscardUnstagedTooltip string - DiscardUnstagedDisabled string + DiscardUnstagedDisabledNoStaged string + DiscardUnstagedDisabledNoUnstaged string Pop string StashPopTooltip string Drop string @@ -1322,8 +1323,9 @@ func EnglishTranslationSet() *TranslationSet { RedoTooltip: "The reflog will be used to determine what git command to run to redo the last git command. This does not include changes to the working tree; only commits are taken into consideration.", UndoMergeResolveTooltip: "Undo last merge conflict resolution.", DiscardAllTooltip: "Discard both staged and unstaged changes in '{{.path}}'.", - DiscardUnstagedTooltip: "Discard unstaged changes in '{{.path}}'.", - DiscardUnstagedDisabled: "The selected items don't have both staged and unstaged changes.", + DiscardUnstagedTooltip: "Discard only unstaged changes in '{{.path}}', keeping any staged changes.", + DiscardUnstagedDisabledNoStaged: "No staged changes to keep.", + DiscardUnstagedDisabledNoUnstaged: "No unstaged changes.", Pop: "Pop", StashPopTooltip: "Apply the stash entry to your working directory and remove the stash entry.", Drop: "Drop",