From 50639ea12c58e32f6e19a89b554a35e55100d443 Mon Sep 17 00:00:00 2001 From: sueka Date: Tue, 2 Feb 2021 07:50:10 +0900 Subject: [PATCH] Fixes #1357 - Corrects the compare functions --- src/git/models/branch.ts | 4 ++-- src/git/models/tag.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/git/models/branch.ts b/src/git/models/branch.ts index efffb6a131aa6..31cc86a54b09d 100644 --- a/src/git/models/branch.ts +++ b/src/git/models/branch.ts @@ -63,7 +63,7 @@ export class GitBranch implements GitBranchReference { (a.name === 'master' ? -1 : 1) - (b.name === 'master' ? -1 : 1) || (a.name === 'develop' ? -1 : 1) - (b.name === 'develop' ? -1 : 1) || (b.remote ? -1 : 1) - (a.remote ? -1 : 1) || - b.name.localeCompare(a.name, undefined, { numeric: true, sensitivity: 'base' }), + a.name.localeCompare(b.name, undefined, { numeric: true, sensitivity: 'base' }), ); default: return branches.sort( @@ -74,7 +74,7 @@ export class GitBranch implements GitBranchReference { (a.name === 'master' ? -1 : 1) - (b.name === 'master' ? -1 : 1) || (a.name === 'develop' ? -1 : 1) - (b.name === 'develop' ? -1 : 1) || (b.remote ? -1 : 1) - (a.remote ? -1 : 1) || - a.name.localeCompare(b.name, undefined, { numeric: true, sensitivity: 'base' }), + b.name.localeCompare(a.name, undefined, { numeric: true, sensitivity: 'base' }), ); } } diff --git a/src/git/models/tag.ts b/src/git/models/tag.ts index 91af17ed10e30..ff5c1aff668ea 100644 --- a/src/git/models/tag.ts +++ b/src/git/models/tag.ts @@ -32,11 +32,11 @@ export class GitTag implements GitTagReference { return tags.sort((a, b) => b.date.getTime() - a.date.getTime()); case TagSorting.NameAsc: return tags.sort((a, b) => - b.name.localeCompare(a.name, undefined, { numeric: true, sensitivity: 'base' }), + a.name.localeCompare(b.name, undefined, { numeric: true, sensitivity: 'base' }), ); default: return tags.sort((a, b) => - a.name.localeCompare(b.name, undefined, { numeric: true, sensitivity: 'base' }), + b.name.localeCompare(a.name, undefined, { numeric: true, sensitivity: 'base' }), ); } }