diff --git a/src/ViewModels/LauncherPage.cs b/src/ViewModels/LauncherPage.cs index 498c1865..78aa9278 100644 --- a/src/ViewModels/LauncherPage.cs +++ b/src/ViewModels/LauncherPage.cs @@ -59,15 +59,17 @@ namespace SourceGit.ViewModels public void StartPopup(Popup popup) { Popup = popup; - ProcessPopup(); + ProcessPopup(true); } - public async void ProcessPopup() + public async void ProcessPopup(bool autoCheck = false) { if (_popup != null) { if (!_popup.Check()) return; + if (autoCheck && !_popup.AutoCheck()) + return; _popup.InProgress = true; var task = _popup.Sure(); diff --git a/src/ViewModels/Popup.cs b/src/ViewModels/Popup.cs index ff74df51..f8991ff4 100644 --- a/src/ViewModels/Popup.cs +++ b/src/ViewModels/Popup.cs @@ -37,6 +37,11 @@ namespace SourceGit.ViewModels return !HasErrors; } + public virtual bool AutoCheck() + { + return true; + } + public virtual Task Sure() { return null; diff --git a/src/ViewModels/Push.cs b/src/ViewModels/Push.cs index 004ae7b6..5f37bfaf 100644 --- a/src/ViewModels/Push.cs +++ b/src/ViewModels/Push.cs @@ -152,6 +152,11 @@ namespace SourceGit.ViewModels View = new Views.Push() { DataContext = this }; } + public override bool AutoCheck() + { + return !string.IsNullOrEmpty(_selectedRemoteBranch?.Head); + } + public override Task Sure() { _repo.SetWatcherEnabled(false); diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 926fd6b6..c91f5e73 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -937,9 +937,6 @@ namespace SourceGit.ViewModels CurrentBranch = branches.Find(x => x.IsCurrent); LocalBranchTrees = builder.Locals; RemoteBranchTrees = builder.Remotes; - - if (_workingCopy != null) - _workingCopy.CanCommitWithPush = _currentBranch != null && !string.IsNullOrEmpty(_currentBranch.Upstream); }); } diff --git a/src/ViewModels/WorkingCopy.cs b/src/ViewModels/WorkingCopy.cs index 616f244a..255d6b6b 100644 --- a/src/ViewModels/WorkingCopy.cs +++ b/src/ViewModels/WorkingCopy.cs @@ -26,12 +26,6 @@ namespace SourceGit.ViewModels } } - public bool CanCommitWithPush - { - get => _canCommitWithPush; - set => SetProperty(ref _canCommitWithPush, value); - } - public bool HasUnsolvedConflicts { get => _hasUnsolvedConflicts; @@ -1625,7 +1619,6 @@ namespace SourceGit.ViewModels private bool _isUnstaging = false; private bool _isCommitting = false; private bool _useAmend = false; - private bool _canCommitWithPush = false; private List _cached = []; private List _unstaged = []; private List _staged = []; diff --git a/src/Views/WorkingCopy.axaml b/src/Views/WorkingCopy.axaml index 7f493b6a..e0d0503d 100644 --- a/src/Views/WorkingCopy.axaml +++ b/src/Views/WorkingCopy.axaml @@ -375,7 +375,6 @@ -