@@ -11,7 +11,6 @@ import { UriComparer } from '../comparers';
1111export 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