@@ -348,8 +348,8 @@ export class GraphGitSubProvider implements GitGraphSubProvider {
348348 branch = branchMap . get ( tip ) ;
349349 branchId = branch ?. id ?? getBranchId ( repoPath , false , tip ) ;
350350
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 ) ;
353353
354354 context = {
355355 webviewItem : `gitlens:branch${ head ? '+current' : '' } ${
@@ -362,7 +362,7 @@ export class GraphGitSubProvider implements GitGraphSubProvider {
362362 : ''
363363 } ${ branch ?. starred ? '+starred' : '' } ${ branch ?. upstream ?. state . ahead ? '+ahead' : '' } ${
364364 branch ?. upstream ?. state . behind ? '+behind' : ''
365- } ${ recomposable ? '+recomposable' : '' } `,
365+ } ${ mergeBaseCommit ? '+recomposable' : '' } `,
366366 webviewItemValue : {
367367 type : 'branch' ,
368368 ref : createReference ( tip , repoPath , {
@@ -372,6 +372,7 @@ export class GraphGitSubProvider implements GitGraphSubProvider {
372372 remote : false ,
373373 upstream : branch ?. upstream ,
374374 } ) ,
375+ mergeBaseCommit : mergeBaseCommit ,
375376 } ,
376377 } ;
377378
@@ -621,8 +622,8 @@ export class GraphGitSubProvider implements GitGraphSubProvider {
621622 return getCommitsForGraphCore . call ( this , defaultLimit , selectSha , undefined , cancellation ) ;
622623 }
623624
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 ;
626627
627628 try {
628629 const upstreamName = branch . upstream ?. name ;
@@ -643,10 +644,11 @@ export class GraphGitSubProvider implements GitGraphSubProvider {
643644 const validTargets = [ validStoredTarget , validStoredMergeBase ] ;
644645 const targetCommit = await this . selectMostRecentMergeBase ( branch . name , validTargets , svc ) ;
645646
646- return Boolean ( targetCommit && targetCommit !== branch . sha ) ;
647+ const isRecomposable = Boolean ( targetCommit && targetCommit !== branch . sha ) ;
648+ return isRecomposable ? targetCommit : undefined ;
647649 } catch {
648650 // If we can't determine, assume not recomposable
649- return false ;
651+ return undefined ;
650652 }
651653 }
652654
0 commit comments