Skip to content

Commit f4d3d17

Browse files
author
Eric Amodio
committed
Reverses diff ordering
Only adds blame code lens within the specified range
1 parent ea33560 commit f4d3d17

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/commands.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export class DiffWithPreviousCommand extends Command {
5454
return this.git.getVersionedFile(uri.path, sha).then(source => {
5555
this.git.getVersionedFile(uri.path, compareWithSha).then(compare => {
5656
const fileName = basename(uri.path);
57-
return commands.executeCommand(VsCodeCommands.Diff, Uri.file(source), Uri.file(compare), `${fileName} (${sha}) ↔ ${fileName} (${compareWithSha})`);
57+
return commands.executeCommand(VsCodeCommands.Diff, Uri.file(compare), Uri.file(source), `${fileName} (${compareWithSha}) ↔ ${fileName} (${sha})`);
5858
})
5959
});
6060
}
@@ -68,7 +68,7 @@ export class DiffWithWorkingCommand extends Command {
6868
execute(uri?: Uri, sha?: string) {
6969
return this.git.getVersionedFile(uri.path, sha).then(compare => {
7070
const fileName = basename(uri.path);
71-
return commands.executeCommand(VsCodeCommands.Diff, uri, Uri.file(compare), `${fileName} (index) ↔ ${fileName} (${sha})`);
71+
return commands.executeCommand(VsCodeCommands.Diff, Uri.file(compare), uri, `${fileName} (${sha}) ↔ ${fileName} (index)`);
7272
});
7373
}
7474
}

src/gitBlameCodeLensProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default class GitBlameCodeLensProvider implements CodeLensProvider {
3838
const lenses: CodeLens[] = [];
3939

4040
// Add codelens to each "group" of blame lines
41-
const lines = blame.lines.filter(l => l.sha === data.sha);
41+
const lines = blame.lines.filter(l => l.sha === data.sha && l.originalLine >= data.range.start.line && l.originalLine <= data.range.end.line);
4242
let lastLine = lines[0].originalLine;
4343
lines.forEach(l => {
4444
if (l.originalLine !== lastLine + 1) {

0 commit comments

Comments
 (0)