@@ -12,7 +12,7 @@ import { SCMMenus } from 'vs/workbench/contrib/scm/browser/menus';
12
12
import { IStorageService , StorageScope , StorageTarget } from 'vs/platform/storage/common/storage' ;
13
13
import { debounce } from 'vs/base/common/decorators' ;
14
14
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace' ;
15
- import { compareFileNames } from 'vs/base/common/comparers' ;
15
+ import { compareFileNames , comparePaths } from 'vs/base/common/comparers' ;
16
16
import { basename } from 'vs/base/common/resources' ;
17
17
import { binarySearch } from 'vs/base/common/arrays' ;
18
18
@@ -131,7 +131,12 @@ export class SCMViewService implements ISCMViewService {
131
131
const name1 = getRepositoryName ( workspaceContextService , op1 ) ;
132
132
const name2 = getRepositoryName ( workspaceContextService , op2 ) ;
133
133
134
- return compareFileNames ( name1 , name2 ) ;
134
+ const nameComparison = compareFileNames ( name1 , name2 ) ;
135
+ if ( nameComparison === 0 && op1 . provider . rootUri && op2 . provider . rootUri ) {
136
+ return comparePaths ( op1 . provider . rootUri . fsPath , op2 . provider . rootUri . fsPath ) ;
137
+ }
138
+
139
+ return nameComparison ;
135
140
} ;
136
141
137
142
scmService . onDidAddRepository ( this . onDidAddRepository , this , this . disposables ) ;
@@ -275,9 +280,7 @@ export class SCMViewService implements ISCMViewService {
275
280
276
281
private insertRepository ( repositories : ISCMRepository [ ] , repository : ISCMRepository ) : void {
277
282
const index = binarySearch ( repositories , repository , this . _compareRepositories ) ;
278
- if ( index < 0 ) {
279
- repositories . splice ( ~ index , 0 , repository ) ;
280
- }
283
+ repositories . splice ( index < 0 ? ~ index : index , 0 , repository ) ;
281
284
}
282
285
283
286
private onWillSaveState ( ) : void {
0 commit comments