Skip to content

Commit c2fbdc0

Browse files
committed
enhance: use Models.NumericSort.Compare instead of string.CompareTo to sort refs
Signed-off-by: leo <[email protected]>
1 parent 3b9fe9d commit c2fbdc0

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/ViewModels/CheckoutCommandPalette.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ private void UpdateBranches()
7979
branches.Sort((l, r) =>
8080
{
8181
if (l.IsLocal == r.IsLocal)
82-
return l.Name.CompareTo(r.Name);
82+
return Models.NumericSort.Compare(l.Name, r.Name);
8383

8484
return l.IsLocal ? -1 : 1;
8585
});

src/ViewModels/CompareCommandPalette.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ private void UpdateRefs()
9191
if (r is Models.Branch rb)
9292
{
9393
if (lb.IsLocal == rb.IsLocal)
94-
return lb.FriendlyName.CompareTo(rb.FriendlyName);
94+
return Models.NumericSort.Compare(lb.FriendlyName, rb.FriendlyName);
9595
return lb.IsLocal ? -1 : 1;
9696
}
9797

@@ -101,7 +101,7 @@ private void UpdateRefs()
101101
if (r is Models.Branch)
102102
return 1;
103103

104-
return (l as Models.Tag).Name.CompareTo((r as Models.Tag).Name);
104+
return Models.NumericSort.Compare((l as Models.Tag).Name, (r as Models.Tag).Name);
105105
});
106106

107107
var autoSelected = _compareTo;

src/ViewModels/MergeCommandPalette.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private void UpdateBranches()
7575
branches.Sort((l, r) =>
7676
{
7777
if (l.IsLocal == r.IsLocal)
78-
return l.Name.CompareTo(r.Name);
78+
return Models.NumericSort.Compare(l.Name, r.Name);
7979

8080
return l.IsLocal ? -1 : 1;
8181
});

0 commit comments

Comments
 (0)