mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-23 01:35:37 -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:
@@ -60,8 +60,10 @@ export default class ShowQuickCommitDetailsCommand extends EditorCommand {
|
||||
} as QuickPickOptions);
|
||||
|
||||
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);
|
||||
@@ -70,7 +72,7 @@ export default class ShowQuickCommitDetailsCommand extends EditorCommand {
|
||||
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
|
||||
}
|
||||
];
|
||||
|
||||
@@ -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
|
||||
}
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user