mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-25 03:12:21 +08:00
enhance: forbid to reword or squash when there're local changes
This commit is contained in:
@@ -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]);
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace SourceGit.ViewModels
|
||||
public Squash(Repository repo, Models.Commit head, Models.Commit parent)
|
||||
{
|
||||
_repo = repo;
|
||||
_message = new Commands.QueryCommitFullMessage(_repo.FullPath, parent.SHA).Result();
|
||||
_message = new Commands.QueryCommitFullMessage(_repo.FullPath, head.SHA).Result();
|
||||
|
||||
Head = head;
|
||||
Parent = parent;
|
||||
|
||||
Reference in New Issue
Block a user