From 546f6284705cd9c8551812476cc64612e257dd36 Mon Sep 17 00:00:00 2001 From: "Dmitrij D. Czarkoff" Date: Sun, 24 Nov 2024 01:32:47 +0000 Subject: [PATCH] fix: don't reverse commit order when cherry-picking (#736) Fixes #726. Looks like a980cc987d60c038e0ce92eee8fb972fb4737ac6 isn't sufficient. It sorts the commits according to the ordering in history, but then CherryPick ViewModel reverses the order. This commit changes CherryPick ViewModel to use string.Join on the commit list without reordering, so that the ordering is controlled entirely by the caller. --- src/ViewModels/CherryPick.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/ViewModels/CherryPick.cs b/src/ViewModels/CherryPick.cs index dde43662..ea601d5a 100644 --- a/src/ViewModels/CherryPick.cs +++ b/src/ViewModels/CherryPick.cs @@ -85,13 +85,9 @@ namespace SourceGit.ViewModels } else { - var builder = new StringBuilder(); - for (int i = Targets.Count - 1; i >= 0; i--) - builder.Append($"{Targets[i].SHA} "); - succ = new Commands.CherryPick( _repo.FullPath, - builder.ToString(), + string.Join(' ', Targets.ConvertAll(c => c.SHA)), !AutoCommit, AppendSourceToMessage, string.Empty).Exec();