@@ -13,7 +13,7 @@ import { Git, Stash } from './git';
13
13
import { Model } from './model' ;
14
14
import { Repository , Resource , ResourceGroupType } from './repository' ;
15
15
import { applyLineChanges , getModifiedRange , intersectDiffWithRange , invertLineChange , toLineRanges } from './staging' ;
16
- import { fromGitUri , toGitUri , isGitUri , toMergeUris } from './uri' ;
16
+ import { fromGitUri , toGitUri , isGitUri , toMergeUris , toMultiFileDiffEditorUris } from './uri' ;
17
17
import { dispose , grep , isDefined , isDescendant , pathEquals , relativePath } from './util' ;
18
18
import { GitTimelineItem } from './timelineProvider' ;
19
19
import { ApiRepository } from './api/api1' ;
@@ -3734,20 +3734,7 @@ export class CommandCenter {
3734
3734
const isChangeUntracked = ! ! stashUntrackedFiles . find ( f => pathEquals ( f , change . uri . fsPath ) ) ;
3735
3735
const modifiedUriRef = ! isChangeUntracked ? stash . hash : stashUntrackedFilesParentCommit ?? stash . hash ;
3736
3736
3737
- switch ( change . status ) {
3738
- case Status . INDEX_ADDED :
3739
- resources . push ( { originalUri : undefined , modifiedUri : toGitUri ( change . uri , modifiedUriRef ) } ) ;
3740
- break ;
3741
- case Status . DELETED :
3742
- resources . push ( { originalUri : toGitUri ( change . uri , stashFirstParentCommit ) , modifiedUri : undefined } ) ;
3743
- break ;
3744
- case Status . INDEX_RENAMED :
3745
- resources . push ( { originalUri : toGitUri ( change . originalUri , stashFirstParentCommit ) , modifiedUri : toGitUri ( change . uri , modifiedUriRef ) } ) ;
3746
- break ;
3747
- default :
3748
- resources . push ( { originalUri : toGitUri ( change . uri , stashFirstParentCommit ) , modifiedUri : toGitUri ( change . uri , modifiedUriRef ) } ) ;
3749
- break ;
3750
- }
3737
+ resources . push ( toMultiFileDiffEditorUris ( change , stashFirstParentCommit , modifiedUriRef ) ) ;
3751
3738
}
3752
3739
3753
3740
commands . executeCommand ( '_workbench.openMultiDiffEditor' , { multiDiffSourceUri, title, resources } ) ;
@@ -3868,15 +3855,15 @@ export class CommandCenter {
3868
3855
}
3869
3856
3870
3857
const commit = await repository . getCommit ( item . ref ) ;
3871
- const commitFiles = await repository . getCommitFiles ( item . ref ) ;
3858
+ const commitParentId = commit . parents . length > 0 ? commit . parents [ 0 ] : `${ commit . hash } ^` ;
3859
+ const changes = await repository . diffBetween ( commitParentId , commit . hash ) ;
3872
3860
3873
3861
const title = `${ item . shortRef } - ${ commit . message } ` ;
3874
3862
const multiDiffSourceUri = toGitUri ( Uri . file ( repository . root ) , item . ref , { scheme : 'git-commit' } ) ;
3875
3863
3876
- const resources : { originalUri : Uri ; modifiedUri : Uri } [ ] = [ ] ;
3877
- for ( const commitFile of commitFiles ) {
3878
- const commitFileUri = Uri . file ( path . join ( repository . root , commitFile ) ) ;
3879
- resources . push ( { originalUri : toGitUri ( commitFileUri , item . previousRef ) , modifiedUri : toGitUri ( commitFileUri , item . ref ) } ) ;
3864
+ const resources : { originalUri : Uri | undefined ; modifiedUri : Uri | undefined } [ ] = [ ] ;
3865
+ for ( const change of changes ) {
3866
+ resources . push ( toMultiFileDiffEditorUris ( change , item . previousRef , item . ref ) ) ;
3880
3867
}
3881
3868
3882
3869
return {
@@ -4073,15 +4060,14 @@ export class CommandCenter {
4073
4060
}
4074
4061
4075
4062
async _viewChanges ( repository : Repository , historyItem : SourceControlHistoryItem , multiDiffSourceUri : Uri , title : string ) : Promise < void > {
4076
- const historyProvider = repository . historyProvider ;
4077
- const historyItemParentId = historyItem . parentIds . length > 0 ? historyItem . parentIds [ 0 ] : undefined ;
4078
- const files = await historyProvider . provideHistoryItemChanges ( historyItem . id , historyItemParentId ) ;
4063
+ const historyItemParentId = historyItem . parentIds . length > 0 ? historyItem . parentIds [ 0 ] : `${ historyItem . id } ^` ;
4064
+ const changes = await repository . diffBetween ( historyItemParentId , historyItem . id ) ;
4079
4065
4080
- if ( files . length === 0 ) {
4066
+ if ( changes . length === 0 ) {
4081
4067
return ;
4082
4068
}
4083
4069
4084
- const resources = files . map ( f => ( { originalUri : f . originalUri , modifiedUri : f . modifiedUri } ) ) ;
4070
+ const resources = changes . map ( c => toMultiFileDiffEditorUris ( c , historyItemParentId , historyItem . id ) ) ;
4085
4071
4086
4072
await commands . executeCommand ( '_workbench.openMultiDiffEditor' , { multiDiffSourceUri, title, resources } ) ;
4087
4073
}
0 commit comments