@@ -82,6 +82,7 @@ import {
8282import type { TimelineWebviewShowingArgs } from './registration' ;
8383import {
8484 areTimelineScopesEqual ,
85+ areTimelineScopesEquivalent ,
8586 deserializeTimelineScope ,
8687 isTimelineScope ,
8788 serializeTimelineScope ,
@@ -155,7 +156,7 @@ export class TimelineWebviewProvider implements WebviewProvider<State, State, Ti
155156 }
156157 }
157158
158- return areTimelineScopesEqual ( scope , this . _context . scope ) ;
159+ return areTimelineScopesEquivalent ( scope , this . _context . scope ) ;
159160 }
160161
161162 getSplitArgs ( ) : WebviewShowingArgs < TimelineWebviewShowingArgs , State > {
@@ -210,9 +211,8 @@ export class TimelineWebviewProvider implements WebviewProvider<State, State, Ti
210211 }
211212 }
212213
213- await this . updateScope ( scope , true ) ;
214-
215- if ( ! loading ) {
214+ const changed = await this . updateScope ( scope , true , true ) ;
215+ if ( ! loading && ( changed || ! this . host . visible ) ) {
216216 this . updateState ( ) ;
217217 }
218218
@@ -903,7 +903,11 @@ export class TimelineWebviewProvider implements WebviewProvider<State, State, Ti
903903
904904 private _repositorySubscription : SubscriptionManager < Repository > | undefined ;
905905
906- private async updateScope ( scope : TimelineScope | undefined , silent ?: boolean ) : Promise < boolean > {
906+ private async updateScope (
907+ scope : TimelineScope | undefined ,
908+ silent ?: boolean ,
909+ allowEquivalent ?: boolean ,
910+ ) : Promise < boolean > {
907911 if ( this . _tabCloseDebounceTimer != null ) {
908912 clearTimeout ( this . _tabCloseDebounceTimer ) ;
909913 this . _tabCloseDebounceTimer = undefined ;
@@ -932,6 +936,7 @@ export class TimelineWebviewProvider implements WebviewProvider<State, State, Ti
932936 if ( repo != null ) {
933937 if ( areUrisEqual ( scope . uri , repo . uri ) ) {
934938 scope . type = 'repo' ;
939+ scope . head ??= getReference ( await repo . git . branches ( ) . getBranch ( ) ) ;
935940 }
936941
937942 this . _repositorySubscription ??= new SubscriptionManager ( repo , r => this . subscribeToRepository ( r ) ) ;
@@ -968,7 +973,12 @@ export class TimelineWebviewProvider implements WebviewProvider<State, State, Ti
968973 this . _repositorySubscription ?. start ( ) ;
969974 }
970975
971- if ( areTimelineScopesEqual ( scope , this . _context . scope ) && areEtagsEqual ( this . _context . etags , etags ) ) {
976+ if (
977+ areEtagsEqual ( this . _context . etags , etags ) &&
978+ ( allowEquivalent
979+ ? areTimelineScopesEquivalent ( scope , this . _context . scope )
980+ : areTimelineScopesEqual ( scope , this . _context . scope ) )
981+ ) {
972982 return false ;
973983 }
974984
0 commit comments