mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-15 17:25:33 -05:00
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:
@@ -109,7 +109,7 @@ export class GitLogParserEnricher implements IGitEnricher<IGitLog> {
|
||||
return entries;
|
||||
}
|
||||
|
||||
enrich(data: string, fileNameOrRepoPath: string, isRepoPath: boolean = false): IGitLog {
|
||||
enrich(data: string, type: 'file' | 'repo', fileNameOrRepoPath: string, isRepoPath: boolean = false): IGitLog {
|
||||
const entries = this._parseEntries(data, isRepoPath);
|
||||
if (!entries) return undefined;
|
||||
|
||||
@@ -160,7 +160,10 @@ export class GitLogParserEnricher implements IGitEnricher<IGitLog> {
|
||||
|
||||
if (recentCommit) {
|
||||
recentCommit.previousSha = commit.sha;
|
||||
recentCommit.previousFileName = commit.originalFileName || commit.fileName;
|
||||
// Only add a filename if this is a file log
|
||||
if (type === 'file') {
|
||||
recentCommit.previousFileName = commit.originalFileName || commit.fileName;
|
||||
}
|
||||
}
|
||||
recentCommit = commit;
|
||||
}
|
||||
|
||||
@@ -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(`--`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user