Fixes #55 - adds fallback for previous git versions

Reverts git version requirement to >= 2.2.0
This commit is contained in:
Eric Amodio
2017-03-27 10:56:58 -04:00
parent 758d331e69
commit 46ff70e969
5 changed files with 64 additions and 17 deletions

View File

@@ -673,16 +673,20 @@ export class GitService extends Disposable {
async getStatusForFile(repoPath: string, fileName: string): Promise<GitStatusFile> {
Logger.log(`getStatusForFile('${repoPath}', '${fileName}')`);
const data = await Git.status_file(repoPath, fileName);
const status = GitStatusParser.parse(data, repoPath);
const porcelainVersion = Git.validateVersion(2, 11) ? 2 : 1;
const data = await Git.status_file(repoPath, fileName, porcelainVersion);
const status = GitStatusParser.parse(data, repoPath, porcelainVersion);
return status && status.files.length && status.files[0];
}
async getStatusForRepo(repoPath: string): Promise<IGitStatus> {
Logger.log(`getStatusForRepo('${repoPath}')`);
const data = await Git.status(repoPath);
return GitStatusParser.parse(data, repoPath);
const porcelainVersion = Git.validateVersion(2, 11) ? 2 : 1;
const data = await Git.status(repoPath, porcelainVersion);
return GitStatusParser.parse(data, repoPath, porcelainVersion);
}
async getVersionedFile(repoPath: string, fileName: string, sha: string) {