fix<Repository, History>: wrong context menu IsEnabled state.

* 'Pull' should always enabled for local branch with remote upstream
* 'Discard All Changes' for current branch should only be enabled when there's at least one changes
* 'Fast Forward' should check if target local branch has any commit ahead of it's upstream
This commit is contained in:
leo 2024-03-01 19:12:22 +08:00
parent 280ef60111
commit 307e5a5ef0
2 changed files with 3 additions and 5 deletions

View file

@ -597,6 +597,7 @@ namespace SourceGit.ViewModels {
var discard = new MenuItem();
discard.Header = App.Text("BranchCM.DiscardAll");
discard.Icon = App.CreateMenuIcon("Icons.Undo");
discard.IsEnabled = _workingCopy.Count > 0;
discard.Click += (o, e) => {
if (PopupHost.CanCreatePopup()) PopupHost.ShowPopup(new Discard(this));
e.Handled = true;
@ -619,7 +620,6 @@ namespace SourceGit.ViewModels {
var pull = new MenuItem();
pull.Header = new Views.NameHighlightedTextBlock("BranchCM.Pull", upstream);
pull.Icon = App.CreateMenuIcon("Icons.Pull");
pull.IsEnabled = !string.IsNullOrEmpty(branch.UpstreamTrackStatus);
pull.Click += (o, e) => {
if (PopupHost.CanCreatePopup()) PopupHost.ShowPopup(new Pull(this, null));
e.Handled = true;