@@ -11,7 +11,7 @@ import { Repository, Git } from './git/git'
1111import { Ref , RefType } from './git/api/git'
1212import { anyEvent , filterEvent , eventToPromise } from './git/util'
1313import { getDefaultBranch , getHeadModificationDate , getBranchCommit ,
14- diffIndex , IDiffStatus , StatusCode , getAbsGitDir , getAbsGitCommonDir ,
14+ diffIndex , IDiffStatus , StatusCode , getAbsGitDir ,
1515 getWorkspaceFolders , getGitRepositoryFolders , hasUncommittedChanges , rmFile } from './gitHelper'
1616import { debounce , throttle } from './git/decorators'
1717import { normalizePath } from './fsUtils' ;
@@ -24,7 +24,7 @@ class FileElement implements IDiffStatus {
2424 public dstRelPath : string ,
2525 public status : StatusCode ,
2626 public isSubmodule : boolean ) { }
27-
27+
2828 get label ( ) : string {
2929 return path . basename ( this . dstAbsPath )
3030 }
@@ -109,11 +109,10 @@ export class GitTreeCompareProvider implements TreeDataProvider<Element>, Dispos
109109 private repository : Repository | undefined ;
110110 private baseRef : string ;
111111 private viewAsList = false ;
112-
112+
113113 // Static state of repository
114114 private workspaceFolder : string ;
115115 private absGitDir : string ;
116- private absGitCommonDir : string ;
117116 private repoRoot : FolderAbsPath ;
118117
119118 // Dynamic state of repository
@@ -127,7 +126,7 @@ export class GitTreeCompareProvider implements TreeDataProvider<Element>, Dispos
127126 // Diff results
128127 private filesInsideTreeRoot : Map < FolderAbsPath , IDiffStatus [ ] > ;
129128 private filesOutsideTreeRoot : Map < FolderAbsPath , IDiffStatus [ ] > ;
130-
129+
131130 // UI parameters, derived
132131 private treeRoot : FolderAbsPath ;
133132
@@ -193,7 +192,6 @@ export class GitTreeCompareProvider implements TreeDataProvider<Element>, Dispos
193192 const dotGit = await this . git . getRepositoryDotGit ( repositoryRoot ) ;
194193 const repository = this . git . open ( repositoryRoot , dotGit ) ;
195194 const absGitDir = await getAbsGitDir ( repository ) ;
196- const absGitCommonDir = await getAbsGitCommonDir ( repository ) ;
197195 const repoRoot = normalizePath ( repository . root ) ;
198196
199197 const workspaceFolders = getWorkspaceFolders ( repoRoot ) ;
@@ -202,7 +200,6 @@ export class GitTreeCompareProvider implements TreeDataProvider<Element>, Dispos
202200 }
203201
204202 this . repository = repository ;
205- this . absGitCommonDir = absGitCommonDir ;
206203 this . absGitDir = absGitDir ;
207204 this . repoRoot = repoRoot ;
208205
@@ -431,7 +428,7 @@ export class GitTreeCompareProvider implements TreeDataProvider<Element>, Dispos
431428 const HEAD = await this . repository ! . getHEAD ( ) ;
432429 // if detached HEAD, then .commit exists, otherwise only .name
433430 const headName = HEAD . name ;
434- const headCommit = HEAD . commit || await getBranchCommit ( this . absGitCommonDir , HEAD . name ! ) ;
431+ const headCommit = HEAD . commit || await getBranchCommit ( HEAD . name ! , this . repository ! ) ;
435432 if ( baseRef ) {
436433 const exists = await this . isRefExisting ( baseRef ) || await this . isCommitExisting ( baseRef ) ;
437434 if ( ! exists ) {
@@ -440,7 +437,7 @@ export class GitTreeCompareProvider implements TreeDataProvider<Element>, Dispos
440437 }
441438 }
442439 if ( ! baseRef ) {
443- baseRef = await this . getStoredBaseRef ( ) ;
440+ baseRef = await this . getStoredBaseRef ( ) ;
444441 }
445442 if ( ! baseRef ) {
446443 baseRef = await getDefaultBranch ( this . repository ! , HEAD ) ;
@@ -602,7 +599,7 @@ export class GitTreeCompareProvider implements TreeDataProvider<Element>, Dispos
602599 // If HEAD is not detached, check if the symbolic ref resolves to a different commit.
603600 if ( this . headName ) {
604601 // this.repository.getBranch() is not used here to avoid git invocation overhead
605- const headCommit = await getBranchCommit ( this . absGitCommonDir , this . headName ) ;
602+ const headCommit = await getBranchCommit ( this . headName , this . repository ! ) ;
606603 if ( this . headCommit !== headCommit ) {
607604 return true ;
608605 }
@@ -688,8 +685,8 @@ export class GitTreeCompareProvider implements TreeDataProvider<Element>, Dispos
688685 if ( oldTreeRootIsRepo != this . treeRootIsRepo ) {
689686 this . updateTreeRootFolder ( ) ;
690687 }
691-
692- if ( oldFullDiff != this . fullDiff ||
688+
689+ if ( oldFullDiff != this . fullDiff ||
693690 oldFindRenames != this . findRenames ||
694691 oldRenameThreshold != this . renameThreshold ||
695692 oldTreeRoot != this . treeRoot ||
@@ -1039,7 +1036,7 @@ export class GitTreeCompareProvider implements TreeDataProvider<Element>, Dispos
10391036 } else {
10401037 throw new Error ( "unsupported item type" ) ;
10411038 }
1042-
1039+
10431040 if ( this . baseRef === baseRef ) {
10441041 return ;
10451042 }
0 commit comments