Browse Source

Fixes #1357 - Corrects the compare functions

main
sueka 3 years ago
committed by Eric Amodio
parent
commit
fc9757e867
2 changed files with 4 additions and 4 deletions
  1. +2
    -2
      src/git/models/branch.ts
  2. +2
    -2
      src/git/models/tag.ts

+ 2
- 2
src/git/models/branch.ts View File

@ -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' }),
);
}
}

+ 2
- 2
src/git/models/tag.ts View File

@ -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' }),
);
}
}

Loading…
Cancel
Save