Skip to content

Commit 25d3895

Browse files
committed
Reverts diff editor changes for diff w/ working
Since we are going forward in time, the changes didn't make sense
1 parent 00d3ee0 commit 25d3895

File tree

2 files changed

+4
-23
lines changed

2 files changed

+4
-23
lines changed

src/commands/diffWithNext.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export interface DiffWithNextCommandArgs {
1212
commit?: GitLogCommit;
1313
range?: Range;
1414

15-
inDiffEditor?: boolean;
1615
line?: number;
1716
showOptions?: TextDocumentShowOptions;
1817
}
@@ -36,7 +35,6 @@ export class DiffWithNextCommand extends ActiveEditorCommand {
3635
return this.execute(context.editor, context.editor.document.uri, args);
3736
}
3837
}
39-
args.inDiffEditor = true;
4038
}
4139

4240
return this.execute(context.editor, context.uri, args);

src/commands/diffWithWorking.ts

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { UriComparer } from '../comparers';
1111
export interface DiffWithWorkingCommandArgs {
1212
commit?: GitCommit;
1313

14-
inDiffEditor?: boolean;
1514
line?: number;
1615
showOptions?: TextDocumentShowOptions;
1716
}
@@ -24,8 +23,8 @@ export class DiffWithWorkingCommand extends ActiveEditorCommand {
2423

2524
protected preExecute(context: CommandContext, args: DiffWithWorkingCommandArgs = {}) {
2625
if (
27-
context.command === Commands.DiffWithWorkingInDiff ||
28-
(context.editor !== undefined && context.editor.viewColumn === undefined)
26+
context.command === Commands.DiffWithWorkingInDiff
27+
// || (context.editor !== undefined && context.editor.viewColumn === undefined)
2928
) {
3029
// HACK: If in a diff, try to determine if we are on the right or left side
3130
// If there is a context uri and it doesn't match the editor uri, assume we are on the left
@@ -35,8 +34,6 @@ export class DiffWithWorkingCommand extends ActiveEditorCommand {
3534
return this.execute(context.editor, context.editor.document.uri, args);
3635
}
3736
}
38-
39-
args.inDiffEditor = true;
4037
}
4138

4239
return this.execute(context.editor, context.uri, args);
@@ -66,18 +63,10 @@ export class DiffWithWorkingCommand extends ActiveEditorCommand {
6663

6764
const status = await Container.git.getStatusForFile(gitUri.repoPath!, gitUri.fsPath);
6865
if (status !== undefined && status.indexStatus !== undefined) {
69-
let sha = GitService.uncommittedStagedSha;
70-
if (args.inDiffEditor) {
71-
const commit = await Container.git.getCommitForFile(gitUri.repoPath!, gitUri.fsPath);
72-
if (commit === undefined) return Messages.showCommitHasNoPreviousCommitWarningMessage();
73-
74-
sha = commit.sha;
75-
}
76-
7766
const diffArgs: DiffWithCommandArgs = {
7867
repoPath: gitUri.repoPath,
7968
lhs: {
80-
sha: sha,
69+
sha: GitService.uncommittedStagedSha,
8170
uri: gitUri.documentUri()
8271
},
8372
rhs: {
@@ -92,15 +81,9 @@ export class DiffWithWorkingCommand extends ActiveEditorCommand {
9281
}
9382
}
9483

95-
// If we are in a diff editor, assume we are on the right side, and need to move back 2 revisions
96-
let sha = gitUri.sha;
97-
if (args.inDiffEditor && sha !== undefined) {
98-
sha = `${sha}^`;
99-
}
100-
10184
try {
10285
args.commit = await Container.git.getCommitForFile(gitUri.repoPath, gitUri.fsPath, {
103-
ref: sha,
86+
ref: gitUri.sha,
10487
firstIfNotFound: true
10588
});
10689
if (args.commit === undefined) {

0 commit comments

Comments
 (0)