Browse Source

Fixes issue w/ previous line diff line # being off

main
Eric Amodio 4 years ago
parent
commit
66d4cf81f5
2 changed files with 7 additions and 3 deletions
  1. +1
    -1
      src/commands/diffLineWithPrevious.ts
  2. +6
    -2
      src/git/gitService.ts

+ 1
- 1
src/commands/diffLineWithPrevious.ts View File

@ -53,7 +53,7 @@ export class DiffLineWithPreviousCommand extends ActiveEditorCommand {
sha: diffUris.current.sha || '',
uri: diffUris.current.documentUri(),
},
line: args.line,
line: diffUris.line,
showOptions: args.showOptions,
};
return commands.executeCommand(Commands.DiffWith, diffArgs);

+ 6
- 2
src/git/gitService.ts View File

@ -2270,7 +2270,7 @@ export class GitService implements Disposable {
editorLine: number,
ref: string | undefined,
skip: number = 0,
): Promise<{ current: GitUri; previous: GitUri | undefined } | undefined> {
): Promise<{ current: GitUri; previous: GitUri | undefined; line: number } | undefined> {
if (ref === GitService.deletedOrMissingSha) return undefined;
let fileName = GitUri.relativeTo(uri, repoPath);
@ -2302,6 +2302,7 @@ export class GitService implements Disposable {
return {
current: GitUri.fromFile(fileName, repoPath, undefined),
previous: GitUri.fromFile(fileName, repoPath, GitService.uncommittedStagedSha),
line: editorLine,
};
}
}
@ -2310,6 +2311,7 @@ export class GitService implements Disposable {
return {
current: GitUri.fromFile(fileName, repoPath, undefined),
previous: await this.getPreviousUri(repoPath, uri, undefined, skip, editorLine),
line: editorLine,
};
}
@ -2353,6 +2355,7 @@ export class GitService implements Disposable {
return {
current: current,
previous: await this.getPreviousUri(repoPath, uri, undefined, skip, editorLine),
line: editorLine,
};
}
@ -2379,7 +2382,8 @@ export class GitService implements Disposable {
return {
current: current,
previous: previous || (await this.getPreviousUri(repoPath, uri, ref, skip, editorLine)),
previous: previous ?? (await this.getPreviousUri(repoPath, uri, ref, skip, editorLine)),
line: editorLine,
};
}

Loading…
Cancel
Save