File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ import { Logger } from './logger';
1010import { Messages } from './messages' ;
1111// import { Telemetry } from './telemetry';
1212
13+ interface GitApi {
14+ getGitPath ( ) : Promise < string > ;
15+ }
16+
1317export async function activate ( context : ExtensionContext ) {
1418 const start = process . hrtime ( ) ;
1519
@@ -36,7 +40,19 @@ export async function activate(context: ExtensionContext) {
3640 const cfg = configuration . get < IConfig > ( ) ;
3741
3842 try {
39- await GitService . initialize ( cfg . advanced . git || workspace . getConfiguration ( 'git' ) . get < string > ( 'path' ) ) ;
43+ let gitPath = cfg . advanced . git ;
44+ if ( ! gitPath ) {
45+ // Try to use the same git as the built-in vscode git extension
46+ try {
47+ const gitExtension = extensions . getExtension ( 'vscode.git' ) ;
48+ if ( gitExtension !== undefined ) {
49+ gitPath = await ( gitExtension . exports as GitApi ) . getGitPath ( ) ;
50+ }
51+ }
52+ catch { }
53+ }
54+
55+ await GitService . initialize ( gitPath || workspace . getConfiguration ( 'git' ) . get < string > ( 'path' ) ) ;
4056 }
4157 catch ( ex ) {
4258 Logger . error ( ex , `GitLens(v${ gitlensVersion } ).activate` ) ;
You can’t perform that action at this time.
0 commit comments