mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-15 17:25:33 -05:00
Fixes issues with diff with previous
Wouldn't always grab the correct commit
This commit is contained in:
@@ -133,7 +133,7 @@ export class GitLogParserEnricher implements IGitEnricher<IGitLog> {
|
||||
}
|
||||
else {
|
||||
// Try to get the repoPath from the most recent commit
|
||||
repoPath = fileNameOrRepoPath.replace(`/${entry.fileName}`, '');
|
||||
repoPath = fileNameOrRepoPath.replace(fileNameOrRepoPath.startsWith('/') ? `/${entry.fileName}` : entry.fileName, '');
|
||||
relativeFileName = path.relative(repoPath, fileNameOrRepoPath).replace(/\\/g, '/');
|
||||
}
|
||||
}
|
||||
@@ -160,9 +160,7 @@ export class GitLogParserEnricher implements IGitEnricher<IGitLog> {
|
||||
|
||||
if (recentCommit) {
|
||||
recentCommit.previousSha = commit.sha;
|
||||
if (!isRepoPath) {
|
||||
recentCommit.previousFileName = commit.originalFileName || commit.fileName;
|
||||
}
|
||||
recentCommit.previousFileName = commit.originalFileName || commit.fileName;
|
||||
}
|
||||
recentCommit = commit;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ export default class Git {
|
||||
|
||||
const params = [`blame`, `--root`, format];
|
||||
if (sha) {
|
||||
params.push(`${sha}^!`);
|
||||
params.push(sha);
|
||||
}
|
||||
|
||||
return gitCommand(root, ...params, `--`, file);
|
||||
@@ -81,7 +81,7 @@ export default class Git {
|
||||
|
||||
const params = [`blame`, `--root`, format, `-L ${startLine},${endLine}`];
|
||||
if (sha) {
|
||||
params.push(`${sha}^!`);
|
||||
params.push(sha);
|
||||
}
|
||||
|
||||
return gitCommand(root, ...params, `--`, file);
|
||||
|
||||
@@ -42,6 +42,8 @@ export class GitUri extends Uri {
|
||||
}
|
||||
|
||||
static fromUri(uri: Uri, git?: GitProvider) {
|
||||
if (uri instanceof GitUri) return uri;
|
||||
|
||||
if (git) {
|
||||
const gitUri = git.getGitUriForFile(uri.fsPath);
|
||||
if (gitUri) return gitUri;
|
||||
|
||||
Reference in New Issue
Block a user