Stops Git from leaking out of GitService

This commit is contained in:
Eric Amodio
2017-04-14 00:29:57 -04:00
parent 8f2ec85c6b
commit f99ba89a4b
7 changed files with 47 additions and 20 deletions

View File

@@ -6,6 +6,7 @@ import * as fs from 'fs';
import * as path from 'path';
import * as tmp from 'tmp';
export { IGit };
export * from './models/models';
export * from './parsers/blameParser';
export * from './parsers/logParser';
@@ -47,7 +48,7 @@ export class Git {
return git;
}
static async getGitPath(gitPath?: string) {
static async getGitPath(gitPath?: string): Promise<IGit> {
git = await findGitPath(gitPath);
Logger.log(`Git found: ${git.version} @ ${git.path === 'git' ? 'PATH' : git.path}`);
return git;

View File

@@ -1,7 +1,7 @@
'use strict';
import { Uri } from 'vscode';
import { DocumentSchemes } from '../constants';
import { Git, GitCommit, GitService, IGitStatusFile } from '../gitService';
import { GitCommit, GitService, IGitStatusFile } from '../gitService';
import * as path from 'path';
export class GitUri extends Uri {
@@ -30,7 +30,7 @@ export class GitUri extends Uri {
base._fsPath = path.resolve(data.repoPath, data.originalFileName || data.fileName);
this.offset = (data.decoration && data.decoration.split('\n').length) || 0;
if (!Git.isUncommitted(data.sha)) {
if (!GitService.isUncommitted(data.sha)) {
this.sha = data.sha;
this.repoPath = data.repoPath;
}
@@ -43,7 +43,7 @@ export class GitUri extends Uri {
const commit = commitOrRepoPath;
base._fsPath = path.resolve(commit.repoPath, commit.originalFileName || commit.fileName);
if (!Git.isUncommitted(commit.sha)) {
if (!GitService.isUncommitted(commit.sha)) {
this.sha = commit.sha;
this.repoPath = commit.repoPath;
}
@@ -64,7 +64,7 @@ export class GitUri extends Uri {
if (this.repoPath) {
directory = path.relative(this.repoPath, directory);
}
directory = Git.normalizePath(directory);
directory = GitService.normalizePath(directory);
return (!directory || directory === '.')
? path.basename(this.fsPath)
@@ -72,7 +72,7 @@ export class GitUri extends Uri {
}
getRelativePath(): string {
return Git.normalizePath(path.relative(this.repoPath, this.fsPath));
return GitService.normalizePath(path.relative(this.repoPath, this.fsPath));
}
static async fromUri(uri: Uri, git: GitService) {