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

@@ -93,8 +93,10 @@ export default class ShowQuickRepoHistoryCommand extends Command {
const filePick = pick as FileQuickPickItem;
if (filePick) {
// TODO need to make log for file -- go from commit to HEAD so we can get the current filename
const log = await this.git.getLogForFile(filePick.uri.fsPath, filePick.sha);
// Get the most recent commit -- so that we can find the real working filename if there was a rename
const workingCommit = await this.git.findMostRecentCommitForFile(filePick.uri.fsPath, filePick.sha);
const log = await this.git.getLogForFile(filePick.uri.fsPath, filePick.sha, undefined, undefined, 2);
if (!log) return window.showWarningMessage(`Unable to open diff`);
const commit = Iterables.find(log.commits.values(), c => c.sha === commitPick.commit.sha);
@@ -103,7 +105,7 @@ export default class ShowQuickRepoHistoryCommand extends Command {
const items: CompareQuickPickItem[] = [
{
label: `Compare with Working Tree`,
description: `\u2022 ${commit.sha} $(git-compare) ${commit.fileName}`,
description: `\u2022 ${commit.sha} $(git-compare) ${(workingCommit || commit).fileName}`,
command: Commands.DiffWithWorking
}
];