fix: wired ordering when cherry-pick multiple commits (#726)

Since the items in `ListBox.SelectedItems`  are not ordered by their position in the list, but in the order user selected, it need be sorted before `cherry-pick`

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2024-11-21 09:57:43 +08:00
parent 142987f73d
commit a980cc987d
No known key found for this signature in database

View file

@ -243,6 +243,12 @@ namespace SourceGit.ViewModels
if (canCherryPick)
{
// Sort selected commits in order.
selected.Sort((l, r) =>
{
return _commits.IndexOf(r) - _commits.IndexOf(l);
});
var cherryPickMultiple = new MenuItem();
cherryPickMultiple.Header = App.Text("CommitCM.CherryPickMultiple");
cherryPickMultiple.Icon = App.CreateMenuIcon("Icons.CherryPick");