Quellcode durchsuchen

Adds support for git.path array

main
Eric Amodio vor 4 Jahren
Ursprung
Commit
ae47fbd175
3 geänderte Dateien mit 16 neuen und 6 gelöschten Zeilen
  1. +1
    -1
      src/git/git.ts
  2. +1
    -1
      src/git/gitService.ts
  3. +14
    -4
      src/git/locator.ts

+ 1
- 1
src/git/git.ts Datei anzeigen

@ -217,7 +217,7 @@ export namespace Git {
return gitInfo.version;
}
export async function setOrFindGitPath(gitPath?: string): Promise<void> {
export async function setOrFindGitPath(gitPath?: string | string[]): Promise<void> {
const start = process.hrtime();
gitInfo = await findGitPath(gitPath);

+ 1
- 1
src/git/gitService.ts Datei anzeigen

@ -154,7 +154,7 @@ export class GitService implements Disposable {
gitPath = gitApi.git.path;
}
await Git.setOrFindGitPath(gitPath ?? configuration.getAny<string>('git.path'));
await Git.setOrFindGitPath(gitPath ?? configuration.getAny<string | string[]>('git.path'));
}
get readonly() {

+ 14
- 4
src/git/locator.ts Datei anzeigen

@ -63,10 +63,20 @@ function findGitWin32(): Promise {
.then(null, () => findSpecificGit('git'));
}
export async function findGitPath(path?: string): Promise<GitLocation> {
export async function findGitPath(paths?: string | string[]): Promise<GitLocation> {
try {
return await findSpecificGit(path ?? 'git');
} catch (ex) {
if (paths == null || typeof paths === 'string') {
return await findSpecificGit(paths ?? 'git');
}
for (const path of paths) {
try {
return await findSpecificGit(path);
} catch {}
}
throw new Error('Unable to find git');
} catch {
try {
switch (process.platform) {
case 'darwin':
@ -76,7 +86,7 @@ export async function findGitPath(path?: string): Promise {
default:
return Promise.reject('Unable to find git');
}
} catch (ex) {
} catch {
return Promise.reject(new Error('Unable to find git'));
}
}

Laden…
Abbrechen
Speichern