@@ -179,7 +179,7 @@ export class DiffsTreeDataProvider implements vscode.TreeDataProvider<string> {
179179
180180 private oldPath ( newPath : string , nodes : FileDiffNode [ ] ) : FileDiffNode | undefined {
181181 for ( const node of nodes ) {
182- if ( newPath === node . newPath && node . oldPath ) {
182+ if ( newPath === node . newPath ) {
183183 return node
184184 }
185185 }
@@ -261,18 +261,21 @@ export class DiffsTreeDataProvider implements vscode.TreeDataProvider<string> {
261261 fileDiff : FileDiffNode | undefined ,
262262 comparison : RepositoryComparison
263263 ) : vscode . TreeItem {
264- const command =
265- uri . isFile ( ) && fileDiff ?. oldPath
266- ? {
267- command : 'vscode.diff' ,
268- title : 'Compare files' ,
269- arguments : [
270- vscode . Uri . parse ( uri . withRevision ( range . base ) . withPath ( fileDiff . oldPath ) . uri ) ,
271- vscode . Uri . parse ( uri . withRevision ( range . head ) . uri ) ,
272- `${ uri . basename ( ) } (${ range . base } ...${ range . head } )` ,
273- ] ,
274- }
275- : undefined
264+ const command = uri . isFile ( )
265+ ? {
266+ command : 'vscode.diff' ,
267+ title : 'Compare files' ,
268+ arguments : [
269+ vscode . Uri . parse (
270+ fileDiff ?. oldPath
271+ ? uri . withRevision ( range . base ) . withPath ( fileDiff . oldPath ) . uri
272+ : this . fs . emptyFileUri ( )
273+ ) ,
274+ vscode . Uri . parse ( uri . withRevision ( range . head ) . uri ) ,
275+ `${ uri . basename ( ) } (${ range . base } ...${ range . head } )` ,
276+ ] ,
277+ }
278+ : undefined
276279
277280 const fileStats = fileDiffStats ( uri , fileDiff , comparison )
278281 const label = uri . treeItemLabel ( parent )
0 commit comments