diff --git a/src/git/git.ts b/src/git/git.ts index af049ac..48b2971 100644 --- a/src/git/git.ts +++ b/src/git/git.ts @@ -4,10 +4,10 @@ import * as path from 'path'; import { GlyphChars } from '../constants'; import { Logger } from '../logger'; import { Objects, Strings } from '../system'; -import { findGitPath, IGitInfo } from './locator'; +import { findGitPath, GitLocation } from './locator'; import { run, RunOptions } from './shell'; -export { IGitInfo }; +export { GitLocation } from './locator'; export * from './models/models'; export * from './parsers/parsers'; export * from './remotes/provider'; @@ -161,7 +161,7 @@ function throwExceptionHandler(ex: Error) { throw ex; } -let gitInfo: IGitInfo; +let gitInfo: GitLocation; export class Git { static shaRegex = /^[0-9a-f]{40}(\^[0-9]*?)??( -)?$/; diff --git a/src/git/gitService.ts b/src/git/gitService.ts index 7c578f8..0f6dc2c 100644 --- a/src/git/gitService.ts +++ b/src/git/gitService.ts @@ -57,10 +57,10 @@ import { Repository, RepositoryChange } from './git'; -import { GitUri, IGitCommitInfo } from './gitUri'; +import { GitUri } from './gitUri'; import { RemoteProviderFactory, RemoteProviderMap } from './remotes/factory'; -export { GitUri, IGitCommitInfo }; +export * from './gitUri'; export * from './models/models'; export * from './formatters/formatters'; export { getNameFromRemoteResource, RemoteProvider, RemoteResource, RemoteResourceType } from './remotes/provider'; diff --git a/src/git/gitUri.ts b/src/git/gitUri.ts index b89ee35..e927527 100644 --- a/src/git/gitUri.ts +++ b/src/git/gitUri.ts @@ -7,7 +7,7 @@ import { Container } from '../container'; import { GitCommit, GitService, IGitStatusFile } from '../git/gitService'; import { Strings } from '../system'; -export interface IGitCommitInfo { +export interface GitCommitish { fileName?: string; repoPath: string; sha?: string; @@ -38,9 +38,9 @@ export class GitUri extends ((Uri as any) as UriEx) { versionedPath?: string; constructor(uri?: Uri); - constructor(uri: Uri, commit: IGitCommitInfo); + constructor(uri: Uri, commit: GitCommitish); constructor(uri: Uri, repoPath: string | undefined); - constructor(uri?: Uri, commitOrRepoPath?: IGitCommitInfo | string) { + constructor(uri?: Uri, commitOrRepoPath?: GitCommitish | string) { if (uri == null) { super(); @@ -215,7 +215,7 @@ export class GitUri extends ((Uri as any) as UriEx) { fileName: data.path, repoPath: repoPath, sha: ref - } as IGitCommitInfo); + } as GitCommitish); } const versionedUri = await Container.git.getVersionedUri(uri); diff --git a/src/git/locator.ts b/src/git/locator.ts index 715aa44..1b76c18 100644 --- a/src/git/locator.ts +++ b/src/git/locator.ts @@ -2,7 +2,7 @@ import * as path from 'path'; import { findExecutable, run } from './shell'; -export interface IGitInfo { +export interface GitLocation { path: string; version: string; } @@ -11,7 +11,7 @@ function parseVersion(raw: string): string { return raw.replace(/^git version /, ''); } -async function findSpecificGit(path: string): Promise { +async function findSpecificGit(path: string): Promise { const version = await run(path, ['--version'], 'utf8'); // If needed, let's update our path to avoid the search on every command if (!path || path === 'git') { @@ -24,7 +24,7 @@ async function findSpecificGit(path: string): Promise { }; } -async function findGitDarwin(): Promise { +async function findGitDarwin(): Promise { try { let path = await run('which', ['git'], 'utf8'); path = path.replace(/^\s+|\s+$/g, ''); @@ -49,19 +49,19 @@ async function findGitDarwin(): Promise { } } -function findSystemGitWin32(basePath: string): Promise { +function findSystemGitWin32(basePath: string): Promise { if (!basePath) return Promise.reject(new Error('Unable to find git')); return findSpecificGit(path.join(basePath, 'Git', 'cmd', 'git.exe')); } -function findGitWin32(): Promise { +function findGitWin32(): Promise { return findSystemGitWin32(process.env['ProgramW6432']!) .then(null, () => findSystemGitWin32(process.env['ProgramFiles(x86)']!)) .then(null, () => findSystemGitWin32(process.env['ProgramFiles']!)) .then(null, () => findSpecificGit('git')); } -export async function findGitPath(path?: string): Promise { +export async function findGitPath(path?: string): Promise { try { return await findSpecificGit(path || 'git'); }