Attempted fix for bad filename to diff w/ working

Tried to find the most recent filename given a commit, but git doesn't seem to want to cooperate
This commit is contained in:
Eric Amodio
2017-02-13 13:19:55 -05:00
parent d5d0c3a28d
commit 5f147f6262
5 changed files with 50 additions and 14 deletions

View File

@@ -87,7 +87,7 @@ export default class Git {
return gitCommand(root, ...params, `--`, file);
}
static log(fileName: string, sha?: string, repoPath?: string, maxCount?: number) {
static log(fileName: string, sha?: string, repoPath?: string, maxCount?: number, reverse: boolean = false) {
const [file, root]: [string, string] = Git.splitPath(Git.normalizePath(fileName), repoPath);
const params = [...DefaultLogParams, `--follow`];
@@ -95,7 +95,12 @@ export default class Git {
params.push(`-n${maxCount}`);
}
if (sha) {
params.push(sha);
if (reverse) {
params.push(`${sha}..HEAD`);
}
else {
params.push(sha);
}
params.push(`--`);
}