From 14b9d938074aa1cd981160dc366b545b1f6be64c Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Mon, 1 May 2017 13:18:13 -0400 Subject: [PATCH] Saves the found git path to avoid constant searchs --- src/git/gitLocator.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/git/gitLocator.ts b/src/git/gitLocator.ts index 0d6d241..733571f 100644 --- a/src/git/gitLocator.ts +++ b/src/git/gitLocator.ts @@ -1,5 +1,5 @@ 'use strict'; -import { spawnPromise } from 'spawn-rx'; +import { findActualExecutable, spawnPromise } from 'spawn-rx'; import * as path from 'path'; export interface IGit { @@ -13,6 +13,11 @@ function parseVersion(raw: string): string { async function findSpecificGit(path: string): Promise { 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 { path, version: parseVersion(version.trim())