File tree Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -508,6 +508,8 @@ def string_decode(v: str) -> str:
508
508
if len (optval ) > 1 and optval [0 ] == '"' and optval [- 1 ] != '"' :
509
509
is_multi_line = True
510
510
optval = string_decode (optval [1 :])
511
+ elif len (optval ) > 1 and optval [0 ] == '"' and optval [- 1 ] == '"' :
512
+ optval = optval [1 :- 1 ].strip ()
511
513
# END handle multi-line
512
514
# Preserves multiple values for duplicate optnames.
513
515
cursect .add (optname , optval )
Original file line number Diff line number Diff line change
1
+ [user]
2
+ name = "Cody Veal"
3
+ email = "cveal05@gmail.com"
Original file line number Diff line number Diff line change @@ -391,7 +391,7 @@ def test_complex_aliases(self):
391
391
with GitConfigParser (file_obj , read_only = False ) as w_config :
392
392
self .assertEqual (
393
393
w_config .get ("alias" , "rbi" ),
394
- ' "!g() { git rebase -i origin/${1:-master} ; } ; g"' ,
394
+ "!g() { git rebase -i origin/${1:-master} ; } ; g" ,
395
395
)
396
396
self .assertEqual (
397
397
file_obj .getvalue (),
@@ -406,6 +406,12 @@ def test_empty_config_value(self):
406
406
with self .assertRaises (cp .NoOptionError ):
407
407
cr .get_value ("color" , "ui" )
408
408
409
+ def test_config_with_quotes (self ):
410
+ cr = GitConfigParser (fixture_path ("git_config_with_quotes" ), read_only = True )
411
+
412
+ self .assertEqual (cr .get ("user" , "name" ), "Cody Veal" )
413
+ self .assertEqual (cr .get ("user" , "email" ), "cveal05@gmail.com" )
414
+
409
415
def test_get_values_works_without_requiring_any_other_calls_first (self ):
410
416
file_obj = self ._to_memcache (fixture_path ("git_config_multiple" ))
411
417
cr = GitConfigParser (file_obj , read_only = True )
You can’t perform that action at this time.
0 commit comments