From 84b2b4d7ae8365fa5c8d2877e161e1e415393fdb Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 17 Nov 2020 21:06:04 +0800 Subject: [PATCH] fix: root commit can NOT be rebased --- src/UI/InteractiveRebase.xaml.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/UI/InteractiveRebase.xaml.cs b/src/UI/InteractiveRebase.xaml.cs index 60710604..9230c021 100644 --- a/src/UI/InteractiveRebase.xaml.cs +++ b/src/UI/InteractiveRebase.xaml.cs @@ -135,7 +135,8 @@ namespace SourceGit.UI { public InteractiveRebase(Git.Repository opened, Git.Commit start) { repo = opened; Items = new ObservableCollection(); - from = start.ShortSHA; + from = $"{start.ShortSHA}^"; + if (start.Parents.Count == 0) from = start.ShortSHA; InitializeComponent(); @@ -144,7 +145,7 @@ namespace SourceGit.UI { Task.Run(() => { var commits = repo.Commits($"{start.SHA}..HEAD"); - commits.Add(start); + if (start.Parents.Count > 0) commits.Add(start); Dispatcher.Invoke(() => { Items.Clear(); @@ -290,7 +291,7 @@ namespace SourceGit.UI { repo.SetWatcherEnabled(false); var editor = Process.GetCurrentProcess().MainModule.FileName; - var errs = repo.RunCommand($"-c sequence.editor=\"\\\"{editor}\\\" --interactive-rebase \\\"{temp}\\\"\" rebase -i {from}^", null); + var errs = repo.RunCommand($"-c sequence.editor=\"\\\"{editor}\\\" --interactive-rebase \\\"{temp}\\\"\" rebase -i {from}", null); repo.AssertCommand(errs); Close();