@@ -256,14 +256,18 @@ class GitGraphView {
256256 // Update the state of the fetch button
257257 this . renderFetchButton ( ) ;
258258
259- // Configure current branches
260- if ( this . currentBranches !== null && ! ( this . currentBranches . length === 1 && this . currentBranches [ 0 ] === SHOW_ALL_BRANCHES ) ) {
261- // Filter any branches that are currently selected, but no longer exist
262- const globPatterns = this . config . customBranchGlobPatterns . map ( ( pattern ) => pattern . glob ) ;
263- this . currentBranches = this . currentBranches . filter ( ( branch ) =>
264- this . gitBranches . includes ( branch ) || globPatterns . includes ( branch )
265- ) ;
266- }
259+ const filterCurrentBranches = ( ) => {
260+ // Configure current branches
261+ if ( this . currentBranches !== null && ! ( this . currentBranches . length === 1 && this . currentBranches [ 0 ] === SHOW_ALL_BRANCHES ) ) {
262+ // Filter any branches that are currently selected, but no longer exist
263+ const globPatterns = this . config . customBranchGlobPatterns . map ( ( pattern ) => pattern . glob ) ;
264+ this . currentBranches = this . currentBranches . filter ( ( branch ) =>
265+ this . gitBranches . includes ( branch ) || globPatterns . includes ( branch ) || branch === 'HEAD'
266+ ) ;
267+ }
268+ } ;
269+
270+ filterCurrentBranches ( ) ;
267271 if ( this . currentBranches === null || this . currentBranches . length === 0 ) {
268272 // No branches are currently selected
269273 const onRepoLoadShowCheckedOutBranch = getOnRepoLoadShowCheckedOutBranch ( this . gitRepos [ this . currentRepo ] . onRepoLoadShowCheckedOutBranch ) ;
@@ -284,15 +288,8 @@ class GitGraphView {
284288 this . currentBranches . push ( SHOW_ALL_BRANCHES ) ;
285289 }
286290 }
291+ filterCurrentBranches ( ) ;
287292
288- // Configure current branches
289- if ( this . currentBranches !== null && ! ( this . currentBranches . length === 1 && this . currentBranches [ 0 ] === SHOW_ALL_BRANCHES ) ) {
290- // Filter any branches that are currently selected, but no longer exist
291- const globPatterns = this . config . customBranchGlobPatterns . map ( ( pattern ) => pattern . glob ) ;
292- this . currentBranches = this . currentBranches . filter ( ( branch ) =>
293- this . gitBranches . includes ( branch ) || globPatterns . includes ( branch )
294- ) ;
295- }
296293 this . saveState ( ) ;
297294 this . currentAuthors = [ ] ;
298295 this . currentAuthors . push ( SHOW_ALL_BRANCHES ) ;
0 commit comments