@@ -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 ) ;
@@ -558,6 +555,7 @@ class GitGraphView {
558555 if ( includeShowAll ) {
559556 options . push ( { name : 'Show All' , value : SHOW_ALL_BRANCHES } ) ;
560557 }
558+ options . push ( { name : 'HEAD' , value : 'HEAD' } ) ;
561559 for ( let i = 0 ; i < this . config . customBranchGlobPatterns . length ; i ++ ) {
562560 options . push ( { name : 'Glob: ' + this . config . customBranchGlobPatterns [ i ] . name , value : this . config . customBranchGlobPatterns [ i ] . glob } ) ;
563561 }
@@ -569,7 +567,7 @@ class GitGraphView {
569567 public getAuthorOptions ( ) : ReadonlyArray < DialogSelectInputOption > {
570568 const options : DialogSelectInputOption [ ] = [ ] ;
571569 options . push ( { name : 'All' , value : SHOW_ALL_BRANCHES } ) ;
572- if ( this . gitConfig && this . gitConfig . authors ) {
570+ if ( this . gitConfig && this . gitConfig . authors ) {
573571 for ( let i = 0 ; i < this ! . gitConfig ! . authors . length ; i ++ ) {
574572 const author = this ! . gitConfig ! . authors [ i ] ;
575573 options . push ( { name : author . name , value : author . name } ) ;
@@ -915,8 +913,8 @@ class GitGraphView {
915913
916914
917915 }
918- function getResizeColHtml ( col :number ) {
919- return ( col > 0 ? '<span class="resizeCol left" data-col="' + ( col - 1 ) + '"></span>' : '' ) + ( col < 4 ? '<span class="resizeCol right" data-col="' + col + '"></span>' : '' ) ;
916+ function getResizeColHtml ( col : number ) {
917+ return ( col > 0 ? '<span class="resizeCol left" data-col="' + ( col - 1 ) + '"></span>' : '' ) + ( col < 4 ? '<span class="resizeCol right" data-col="' + col + '"></span>' : '' ) ;
920918 }
921919 this . tableElem . innerHTML = '<table>' + html + '</table>' ;
922920 this . footerElem . innerHTML = this . moreCommitsAvailable ? '<div id="loadMoreCommitsBtn" class="roundedBtn">Load More Commits</div>' : '' ;
@@ -2942,20 +2940,20 @@ class GitGraphView {
29422940 this . renderCdvFileViewTypeBtns ( ) ;
29432941 }
29442942
2945- private openFolders ( open :boolean ) {
2943+ private openFolders ( open : boolean ) {
29462944 let expandedCommit = this . expandedCommit ;
29472945 if ( expandedCommit === null || expandedCommit . fileTree === null ) return ;
29482946 let folders = document . getElementsByClassName ( 'fileTreeFolder' ) ;
29492947 for ( let i = 0 ; i < folders . length ; i ++ ) {
29502948 let sourceElem = < HTMLElement > ( folders [ i ] ) ;
29512949 let parent = sourceElem . parentElement ! ;
2952- if ( open ) {
2950+ if ( open ) {
29532951 parent . classList . remove ( 'closed' ) ;
29542952 sourceElem . children [ 0 ] . children [ 0 ] . innerHTML = SVG_ICONS . openFolder ;
29552953 parent . children [ 1 ] . classList . remove ( 'hidden' ) ;
29562954 alterFileTreeFolderOpen ( expandedCommit . fileTree , decodeURIComponent ( sourceElem . dataset . folderpath ! ) , true ) ;
29572955
2958- } else {
2956+ } else {
29592957 parent . classList . add ( 'closed' ) ;
29602958 sourceElem . children [ 0 ] . children [ 0 ] . innerHTML = SVG_ICONS . closedFolder ;
29612959 parent . children [ 1 ] . classList . add ( 'hidden' ) ;
@@ -3210,7 +3208,7 @@ class GitGraphView {
32103208 function setFolderBtns ( ) {
32113209 let btns = document . getElementsByClassName ( 'cdvFolderBtn' ) ;
32123210 for ( let i = 0 ; i < btns . length ; i ++ ) {
3213- if ( listView )
3211+ if ( listView )
32143212 btns [ i ] . classList . add ( 'hidden' ) ;
32153213 else
32163214 btns [ i ] . classList . remove ( 'hidden' ) ;
0 commit comments