File tree 1 file changed +14
-2
lines changed
src/env/node/git/sub-providers
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { exec } from 'child_process' ;
2
2
import { promises as fs } from 'fs' ;
3
3
import { homedir } from 'os' ;
4
- import type { Uri } from 'vscode' ;
4
+ import { Uri } from 'vscode' ;
5
5
import type { Container } from '../../../../container' ;
6
6
import type { GitCache } from '../../../../git/cache' ;
7
7
import {
@@ -112,8 +112,20 @@ export class WorktreesGitSubProvider implements GitWorktreesSubProvider {
112
112
}
113
113
114
114
@log ( )
115
- // eslint-disable-next-line @typescript-eslint/require-await
116
115
async getWorktreesDefaultUri ( repoPath : string ) : Promise < Uri | undefined > {
116
+ let defaultUri = this . getWorktreesDefaultUriCore ( repoPath ) ;
117
+ if ( defaultUri != null ) return defaultUri ;
118
+
119
+ // If we don't have a default set, default it to the parent folder of the repo folder
120
+ const repo = this . container . git . getRepository ( repoPath ) ;
121
+ defaultUri = ( await repo ?. getCommonRepositoryUri ( ) ) ?? repo ?. uri ;
122
+ if ( defaultUri != null ) {
123
+ defaultUri = Uri . joinPath ( defaultUri , '..' ) ;
124
+ }
125
+ return defaultUri ;
126
+ }
127
+
128
+ private getWorktreesDefaultUriCore ( repoPath : string ) : Uri | undefined {
117
129
let location = configuration . get ( 'worktrees.defaultLocation' ) ;
118
130
if ( location == null ) return undefined ;
119
131
You can’t perform that action at this time.
0 commit comments