mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-16 10:58:34 -05:00
Saves the found git path to avoid constant searchs
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { spawnPromise } from 'spawn-rx';
|
import { findActualExecutable, spawnPromise } from 'spawn-rx';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
export interface IGit {
|
export interface IGit {
|
||||||
@@ -13,6 +13,11 @@ function parseVersion(raw: string): string {
|
|||||||
|
|
||||||
async function findSpecificGit(path: string): Promise<IGit> {
|
async function findSpecificGit(path: string): Promise<IGit> {
|
||||||
const version = await spawnPromise(path, ['--version']);
|
const version = await spawnPromise(path, ['--version']);
|
||||||
|
// If needed, let's update our path to avoid the search on every command
|
||||||
|
if (!path || path === 'git') {
|
||||||
|
path = findActualExecutable(path, ['--version']).cmd;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
path,
|
path,
|
||||||
version: parseVersion(version.trim())
|
version: parseVersion(version.trim())
|
||||||
|
|||||||
Reference in New Issue
Block a user