enhance: forbid to rebase interactively if there're local changes

This commit is contained in:
leo 2024-06-25 10:32:53 +08:00
parent 2d4f8709ca
commit bf44c0d8cc
No known key found for this signature in database

View file

@ -296,6 +296,12 @@ namespace SourceGit.ViewModels
interactiveRebase.IsVisible = current.Head != commit.SHA; interactiveRebase.IsVisible = current.Head != commit.SHA;
interactiveRebase.Click += (o, e) => interactiveRebase.Click += (o, e) =>
{ {
if (_repo.WorkingCopyChangesCount > 0)
{
App.RaiseException(_repo.FullPath, "You have local changes. Please run stash or discard first.");
return;
}
var dialog = new Views.InteractiveRebase() { DataContext = new InteractiveRebase(_repo, current, commit) }; var dialog = new Views.InteractiveRebase() { DataContext = new InteractiveRebase(_repo, current, commit) };
dialog.ShowDialog(App.GetTopLevel() as Window); dialog.ShowDialog(App.GetTopLevel() as Window);
e.Handled = true; e.Handled = true;