@@ -348,8 +348,8 @@ export class GraphGitSubProvider implements GitGraphSubProvider {
348
348
branch = branchMap . get ( tip ) ;
349
349
branchId = branch ?. id ?? getBranchId ( repoPath , false , tip ) ;
350
350
351
- // Check if branch has commits that can be recomposed
352
- const recomposable = await this . isBranchRecomposable ( branch , repoPath ) ;
351
+ // Check if branch has commits that can be recomposed and get merge base
352
+ const mergeBaseCommit = await this . getMergeBaseCommit ( branch , repoPath ) ;
353
353
354
354
context = {
355
355
webviewItem : `gitlens:branch${ head ? '+current' : '' } ${
@@ -362,7 +362,7 @@ export class GraphGitSubProvider implements GitGraphSubProvider {
362
362
: ''
363
363
} ${ branch ?. starred ? '+starred' : '' } ${ branch ?. upstream ?. state . ahead ? '+ahead' : '' } ${
364
364
branch ?. upstream ?. state . behind ? '+behind' : ''
365
- } ${ recomposable ? '+recomposable' : '' } `,
365
+ } ${ mergeBaseCommit ? '+recomposable' : '' } `,
366
366
webviewItemValue : {
367
367
type : 'branch' ,
368
368
ref : createReference ( tip , repoPath , {
@@ -372,6 +372,7 @@ export class GraphGitSubProvider implements GitGraphSubProvider {
372
372
remote : false ,
373
373
upstream : branch ?. upstream ,
374
374
} ) ,
375
+ mergeBaseCommit : mergeBaseCommit ,
375
376
} ,
376
377
} ;
377
378
@@ -621,8 +622,8 @@ export class GraphGitSubProvider implements GitGraphSubProvider {
621
622
return getCommitsForGraphCore . call ( this , defaultLimit , selectSha , undefined , cancellation ) ;
622
623
}
623
624
624
- private async isBranchRecomposable ( branch : GitBranch | undefined , repoPath : string ) : Promise < boolean > {
625
- if ( ! branch || branch . remote ) return false ;
625
+ private async getMergeBaseCommit ( branch : GitBranch | undefined , repoPath : string ) : Promise < string | undefined > {
626
+ if ( ! branch || branch . remote ) return undefined ;
626
627
627
628
try {
628
629
const upstreamName = branch . upstream ?. name ;
@@ -643,10 +644,11 @@ export class GraphGitSubProvider implements GitGraphSubProvider {
643
644
const validTargets = [ validStoredTarget , validStoredMergeBase ] ;
644
645
const targetCommit = await this . selectMostRecentMergeBase ( branch . name , validTargets , svc ) ;
645
646
646
- return Boolean ( targetCommit && targetCommit !== branch . sha ) ;
647
+ const isRecomposable = Boolean ( targetCommit && targetCommit !== branch . sha ) ;
648
+ return isRecomposable ? targetCommit : undefined ;
647
649
} catch {
648
650
// If we can't determine, assume not recomposable
649
- return false ;
651
+ return undefined ;
650
652
}
651
653
}
652
654
0 commit comments