enhance: forbid to reword or squash when there're local changes

This commit is contained in:
leo 2024-06-25 10:26:31 +08:00
parent 3b7545e4fb
commit 2d4f8709ca
No known key found for this signature in database
3 changed files with 43 additions and 33 deletions

View file

@ -217,6 +217,12 @@ namespace SourceGit.ViewModels
reword.Icon = App.CreateMenuIcon("Icons.Edit");
reword.Click += (o, e) =>
{
if (_repo.WorkingCopyChangesCount > 0)
{
App.RaiseException(_repo.FullPath, "You have local changes. Please run stash or discard first.");
return;
}
if (PopupHost.CanCreatePopup())
PopupHost.ShowPopup(new Reword(_repo, commit));
e.Handled = true;
@ -229,6 +235,12 @@ namespace SourceGit.ViewModels
squash.IsEnabled = commit.Parents.Count == 1;
squash.Click += (o, e) =>
{
if (_repo.WorkingCopyChangesCount > 0)
{
App.RaiseException(_repo.FullPath, "You have local changes. Please run stash or discard first.");
return;
}
if (commit.Parents.Count == 1)
{
var parent = _commits.Find(x => x.SHA == commit.Parents[0]);