@@ -74,9 +74,12 @@ export class DiffWithCommand extends GlCommandBase {
7474
7575 async execute ( args ?: DiffWithCommandArgs ) : Promise < any > {
7676 if ( args ?. lhs == null || args ?. rhs == null ) return ;
77+ if ( args . repoPath == null ) {
78+ debugger ;
79+ return ;
80+ }
7781
78- const repo = args . repoPath ? this . container . git . getRepository ( args . repoPath ) : undefined ;
79- if ( repo == null ) return ;
82+ const { git } = this . container ;
8083
8184 try {
8285 let {
@@ -86,8 +89,8 @@ export class DiffWithCommand extends GlCommandBase {
8689 const showOptions = { viewColumn : ViewColumn . Active , ...args . showOptions } ;
8790
8891 let [ lhsResolvedResult , rhsResolvedResult ] = await Promise . allSettled ( [
89- repo . git . revision ( ) . resolveRevision ( lhsSha , lhsUri ) ,
90- repo . git . revision ( ) . resolveRevision ( rhsSha , rhsUri ) ,
92+ git . revision ( args . repoPath ) . resolveRevision ( lhsSha , lhsUri ) ,
93+ git . revision ( args . repoPath ) . resolveRevision ( rhsSha , rhsUri ) ,
9194 ] ) ;
9295
9396 let lhsResolved = getSettledValue ( lhsResolvedResult ) ! ;
@@ -96,8 +99,8 @@ export class DiffWithCommand extends GlCommandBase {
9699 // If both are missing, check for renames by swapping the paths
97100 if ( lhsResolved . sha === deletedOrMissing && rhsResolved . sha === deletedOrMissing ) {
98101 [ lhsResolvedResult , rhsResolvedResult ] = await Promise . allSettled ( [
99- repo ?. git . revision ( ) . resolveRevision ( lhsSha , rhsUri ) ,
100- repo ?. git . revision ( ) . resolveRevision ( rhsSha , lhsUri ) ,
102+ git . revision ( args . repoPath ) . resolveRevision ( lhsSha , rhsUri ) ,
103+ git . revision ( args . repoPath ) . resolveRevision ( rhsSha , lhsUri ) ,
101104 ] ) ;
102105
103106 lhsResolved = getSettledValue ( lhsResolvedResult ) ! ;
@@ -118,8 +121,8 @@ export class DiffWithCommand extends GlCommandBase {
118121 }
119122
120123 const [ lhsResult , rhsResult ] = await Promise . allSettled ( [
121- repo . git . getBestRevisionUri ( lhsUri . fsPath , lhsResolved . sha ) ,
122- repo . git . getBestRevisionUri ( rhsUri . fsPath , rhsResolved . sha ) ,
124+ git . getBestRevisionUri ( args . repoPath , lhsUri . fsPath , lhsResolved . sha ) ,
125+ git . getBestRevisionUri ( args . repoPath , rhsUri . fsPath , rhsResolved . sha ) ,
123126 ] ) ;
124127
125128 const lhs = getSettledValue ( lhsResult ) ;
@@ -168,8 +171,8 @@ export class DiffWithCommand extends GlCommandBase {
168171 }
169172
170173 await openDiffEditor (
171- lhs ?? repo . git . getRevisionUri ( deletedOrMissing , args . lhs . uri . fsPath ) ,
172- rhs ?? repo . git . getRevisionUri ( deletedOrMissing , args . rhs . uri . fsPath ) ,
174+ lhs ?? git . getRevisionUri ( args . repoPath , deletedOrMissing , args . lhs . uri . fsPath ) ,
175+ rhs ?? git . getRevisionUri ( args . repoPath , deletedOrMissing , args . rhs . uri . fsPath ) ,
173176 title ,
174177 showOptions ,
175178 ) ;
0 commit comments