Browse Source

Renames a few interfaces to remove I prefix

main
Eric Amodio 6 years ago
parent
commit
4de6ac2d44
4 changed files with 15 additions and 15 deletions
  1. +3
    -3
      src/git/git.ts
  2. +2
    -2
      src/git/gitService.ts
  3. +4
    -4
      src/git/gitUri.ts
  4. +6
    -6
      src/git/locator.ts

+ 3
- 3
src/git/git.ts View File

@ -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]*?)??( -)?$/;

+ 2
- 2
src/git/gitService.ts View File

@ -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';

+ 4
- 4
src/git/gitUri.ts View File

@ -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);

+ 6
- 6
src/git/locator.ts View File

@ -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<IGitInfo> {
async function findSpecificGit(path: string): Promise<GitLocation> {
const version = await run<string>(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<IGitInfo> {
async function findGitDarwin(): Promise<GitLocation> {
try {
let path = await run<string>('which', ['git'], 'utf8');
path = path.replace(/^\s+|\s+$/g, '');
@ -49,19 +49,19 @@ async function findGitDarwin(): Promise {
}
}
function findSystemGitWin32(basePath: string): Promise<IGitInfo> {
function findSystemGitWin32(basePath: string): Promise<GitLocation> {
if (!basePath) return Promise.reject(new Error('Unable to find git'));
return findSpecificGit(path.join(basePath, 'Git', 'cmd', 'git.exe'));
}
function findGitWin32(): Promise<IGitInfo> {
function findGitWin32(): Promise<GitLocation> {
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<IGitInfo> {
export async function findGitPath(path?: string): Promise<GitLocation> {
try {
return await findSpecificGit(path || 'git');
}

Loading…
Cancel
Save