File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
src/env/node/git/sub-providers Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 11import { exec } from 'child_process' ;
22import { promises as fs } from 'fs' ;
33import { homedir } from 'os' ;
4- import type { Uri } from 'vscode' ;
4+ import { Uri } from 'vscode' ;
55import type { Container } from '../../../../container' ;
66import type { GitCache } from '../../../../git/cache' ;
77import {
@@ -112,8 +112,20 @@ export class WorktreesGitSubProvider implements GitWorktreesSubProvider {
112112 }
113113
114114 @log ( )
115- // eslint-disable-next-line @typescript-eslint/require-await
116115 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 {
117129 let location = configuration . get ( 'worktrees.defaultLocation' ) ;
118130 if ( location == null ) return undefined ;
119131
You can’t perform that action at this time.
0 commit comments