Browse Source

Adds more logging to track down #1752

main
Eric Amodio 2 years ago
parent
commit
ff46108468
2 changed files with 13 additions and 12 deletions
  1. +4
    -4
      src/env/node/git/localGitProvider.ts
  2. +9
    -8
      src/env/node/git/locator.ts

+ 4
- 4
src/env/node/git/localGitProvider.ts View File

@ -313,13 +313,13 @@ export class LocalGitProvider implements GitProvider, Disposable {
}, 1000); }, 1000);
if (cc != null) { if (cc != null) {
cc.exitDetails = ` ${GlyphChars.Dot} Git found (${getDurationMilliseconds(start)} ms): ${
location.version
} @ ${location.path === 'git' ? 'PATH' : location.path}`;
cc.exitDetails = ` ${GlyphChars.Dot} Git (${location.version}) found in ${
location.path === 'git' ? 'PATH' : location.path
}`;
} else { } else {
Logger.log( Logger.log(
cc, cc,
`Git found: ${location.version} @ ${location.path === 'git' ? 'PATH' : location.path} ${
`Git (${location.version}) found in ${location.path === 'git' ? 'PATH' : location.path} ${
GlyphChars.Dot GlyphChars.Dot
} ${getDurationMilliseconds(start)} ms`, } ${getDurationMilliseconds(start)} ms`,
); );

+ 9
- 8
src/env/node/git/locator.ts View File

@ -26,10 +26,6 @@ export interface GitLocation {
version: string; version: string;
} }
function parseVersion(raw: string): string {
return raw?.replace(/^git version /, '');
}
async function findSpecificGit(path: string): Promise<GitLocation> { async function findSpecificGit(path: string): Promise<GitLocation> {
const sw = new Stopwatch(`findSpecificGit(${path})`, { logLevel: LogLevel.Debug }); const sw = new Stopwatch(`findSpecificGit(${path})`, { logLevel: LogLevel.Debug });
@ -37,7 +33,7 @@ async function findSpecificGit(path: string): Promise {
try { try {
version = await run<string>(path, ['--version'], 'utf8'); version = await run<string>(path, ['--version'], 'utf8');
} catch (ex) { } catch (ex) {
sw.stop({ message: ` ${GlyphChars.Dot} Unable to find git` });
sw.stop({ message: ` ${GlyphChars.Dot} Unable to find git: ${ex}` });
if (/bad config/i.test(ex.message)) throw new InvalidGitConfigError(ex); if (/bad config/i.test(ex.message)) throw new InvalidGitConfigError(ex);
throw ex; throw ex;
@ -51,7 +47,7 @@ async function findSpecificGit(path: string): Promise {
try { try {
version = await run<string>(foundPath, ['--version'], 'utf8'); version = await run<string>(foundPath, ['--version'], 'utf8');
} catch (ex) { } catch (ex) {
sw.stop({ message: ` ${GlyphChars.Dot} Unable to find git` });
sw.stop({ message: ` ${GlyphChars.Dot} Unable to find git: ${ex}` });
if (/bad config/i.test(ex.message)) throw new InvalidGitConfigError(ex); if (/bad config/i.test(ex.message)) throw new InvalidGitConfigError(ex);
throw ex; throw ex;
@ -60,11 +56,16 @@ async function findSpecificGit(path: string): Promise {
path = foundPath; path = foundPath;
} }
sw.stop({ message: ` ${GlyphChars.Dot} Found git @ ${path}` });
const parsed = version
.trim()
.replace(/^git version /, '')
.trim();
sw.stop({ message: ` ${GlyphChars.Dot} Found ${parsed} in ${path}; ${version}` });
return { return {
path: path, path: path,
version: parseVersion(version.trim()),
version: parsed,
}; };
} }

Loading…
Cancel
Save