Stops repo log from limiting to a single sha

Gets log reverse to work
This commit is contained in:
Eric Amodio
2017-03-11 04:09:58 -05:00
parent 3435ada188
commit f499bffbc6
2 changed files with 5 additions and 3 deletions

View File

@@ -154,11 +154,13 @@ export default class Git {
const [file, root]: [string, string] = Git.splitPath(Git.normalizePath(fileName), repoPath); const [file, root]: [string, string] = Git.splitPath(Git.normalizePath(fileName), repoPath);
const params = [...DefaultLogParams, `--follow`]; const params = [...DefaultLogParams, `--follow`];
if (maxCount) { if (maxCount && !reverse) {
params.push(`-n${maxCount}`); params.push(`-n${maxCount}`);
} }
if (sha) { if (sha) {
if (reverse) { if (reverse) {
params.push(`--reverse`);
params.push(`--ancestry-path`);
params.push(`${sha}..HEAD`); params.push(`${sha}..HEAD`);
} }
else { else {
@@ -192,7 +194,7 @@ export default class Git {
params.push(`-n${maxCount}`); params.push(`-n${maxCount}`);
} }
if (sha) { if (sha) {
params.push(`${sha}^!`); params.push(sha);
} }
return gitCommand(repoPath, ...params); return gitCommand(repoPath, ...params);
} }

View File

@@ -506,7 +506,7 @@ export class GitProvider extends Disposable {
} }
getLogForFile(fileName: string, sha?: string, repoPath?: string, range?: Range, maxCount?: number, reverse: boolean = false): Promise<IGitLog | undefined> { getLogForFile(fileName: string, sha?: string, repoPath?: string, range?: Range, maxCount?: number, reverse: boolean = false): Promise<IGitLog | undefined> {
Logger.log(`getLogForFile('${fileName}', ${sha}, '${repoPath}', ${range && `[${range.start.line}, ${range.end.line}]`}, ${maxCount})`); Logger.log(`getLogForFile('${fileName}', ${sha}, '${repoPath}', ${range && `[${range.start.line}, ${range.end.line}]`}, ${maxCount}, ${reverse})`);
fileName = Git.normalizePath(fileName); fileName = Git.normalizePath(fileName);
const useCaching = this.UseGitCaching && !sha && !range && !maxCount; const useCaching = this.UseGitCaching && !sha && !range && !maxCount;