File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -73,13 +73,18 @@ export function parseGitShowBranchForStatus(
7373 const branchColumns = new Map < string , number > ( ) ;
7474
7575 for ( const line of headerLines ) {
76- const headerMatch = / ^ ( \s * ) [ ! * + ] \s + \[ ( [ ^ \] ] + ) \] / . exec ( line ) ;
77- if ( ! headerMatch ) {
76+ const indicatorIndex = line . search ( / [ ! * + ] / ) ;
77+ if ( indicatorIndex === - 1 ) {
7878 continue ;
7979 }
8080
81- const [ , leadingSpaces , branchName ] = headerMatch ;
82- branchColumns . set ( branchName , leadingSpaces . length ) ;
81+ const branchNameMatch = / \[ ( [ ^ \] ] + ) \] / . exec ( line ) ;
82+ if ( ! branchNameMatch ) {
83+ continue ;
84+ }
85+
86+ const [ , branchName ] = branchNameMatch ;
87+ branchColumns . set ( branchName , indicatorIndex ) ;
8388 }
8489
8590 const headColumn = branchColumns . get ( "HEAD" ) ;
You can’t perform that action at this time.
0 commit comments