File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -709,7 +709,7 @@ interface GitConfigSection {
709
709
}
710
710
711
711
class GitConfigParser {
712
- private static readonly _lineSeparator = / \r ? \n / g ;
712
+ private static readonly _lineSeparator = / \r ? \n / ;
713
713
714
714
private static readonly _propertyRegex = / ^ \s * ( \w + ) \s * = \s * ( .* ) $ / ;
715
715
private static readonly _sectionRegex = / ^ \s * \[ \s * ( [ ^ \] ] + ?) \s * ( \" [ ^ " ] + \" ) * \] \s * $ / ;
@@ -723,13 +723,8 @@ class GitConfigParser {
723
723
config . sections . push ( section ) ;
724
724
} ;
725
725
726
- let position = 0 ;
727
- let match : RegExpExecArray | null = null ;
728
-
729
- while ( match = GitConfigParser . _lineSeparator . exec ( raw ) ) {
730
- const line = raw . substring ( position , match . index ) ;
731
- position = match . index + match [ 0 ] . length ;
732
-
726
+ for ( const line of raw . split ( GitConfigParser . _lineSeparator ) ) {
727
+ // Section
733
728
const sectionMatch = line . match ( GitConfigParser . _sectionRegex ) ;
734
729
if ( sectionMatch ?. length === 3 ) {
735
730
addSection ( section ) ;
@@ -738,7 +733,7 @@ class GitConfigParser {
738
733
continue ;
739
734
}
740
735
741
- // Properties
736
+ // Property
742
737
const propertyMatch = line . match ( GitConfigParser . _propertyRegex ) ;
743
738
if ( propertyMatch ?. length === 3 && ! Object . keys ( section . properties ) . includes ( propertyMatch [ 1 ] ) ) {
744
739
section . properties [ propertyMatch [ 1 ] ] = propertyMatch [ 2 ] ;
You can’t perform that action at this time.
0 commit comments