@@ -219,22 +219,31 @@ export class GitCommit implements GitRevisionReference {
219219
220220 // If the commit is "uncommitted", then have the files list be all uncommitted files
221221 if ( this . isUncommitted ) {
222- const repository = this . container . git . getRepository ( this . repoPath ) ;
223- this . _etagFileSystem = repository ?. etagFileSystem ;
222+ const repo = this . container . git . getRepository ( this . repoPath ) ;
223+ this . _etagFileSystem = repo ?. etagFileSystem ;
224224
225225 if ( this . _etagFileSystem != null ) {
226- const status = await this . container . git . status ( this . repoPath ) . getStatus ( ) ;
226+ const status = await repo ?. git . status ( ) . getStatus ( ) ;
227227 if ( status != null ) {
228228 this . _files = status . files . flatMap ( f => f . getPseudoFileChanges ( ) ) ;
229+ if ( isUncommittedStaged ( this . sha ) ) {
230+ this . _files = this . _files . filter ( f => f . staged ) ;
231+ }
229232 }
230- this . _etagFileSystem = repository ?. etagFileSystem ;
233+ this . _etagFileSystem = repo ?. etagFileSystem ;
231234 }
232235
233236 if ( this . _files == null ) {
234237 this . _files = this . file != null ? [ this . file ] : [ ] ;
235238 }
236239
237- this . _recomputeStats = true ;
240+ if ( options ?. include ?. stats ) {
241+ const stats = await repo ?. git . diff ( ) . getChangedFilesCount ( this . sha ) ;
242+ this . _stats = stats ;
243+ this . _recomputeStats = false ;
244+ } else {
245+ this . _recomputeStats = true ;
246+ }
238247
239248 return ;
240249 }
@@ -612,10 +621,11 @@ export class GitCommit implements GitRevisionReference {
612621 lines ?: GitCommitLine [ ] ;
613622 stats ?: GitCommitStats ;
614623 } ) : T {
615- let files ;
624+ let files : { file ?: GitFileChange ; files ?: GitFileChange [ ] } | undefined = {
625+ file : this . _file ,
626+ files : this . _files ,
627+ } ;
616628 if ( changes . files != null ) {
617- files = { file : this . _file , files : this . _files } ;
618-
619629 if ( changes . files . file != null ) {
620630 files . file = changes . files . file ;
621631 } else if ( changes . files . file === null ) {
0 commit comments