Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcf8029d

Browse files
authored
Merge pull request#2036 from EliahKagan/quoted-whitespace
Preserve quoted leading and trailing single-line config var whitespace
2 parents4dd5d45 +bd2b930 commitcf8029d

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

‎git/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ def string_decode(v: str) -> str:
509509
is_multi_line=True
510510
optval=string_decode(optval[1:])
511511
eliflen(optval)>1andoptval[0]=='"'andoptval[-1]=='"':
512-
optval=optval[1:-1].strip()
512+
optval=optval[1:-1]
513513
# END handle multi-line
514514
# Preserves multiple values for duplicate optnames.
515515
cursect.add(optname,optval)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[core]
2+
commentString = "# "

‎test/test_config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,10 @@ def test_config_with_quotes(self):
412412
self.assertEqual(cr.get("user","name"),"Cody Veal")
413413
self.assertEqual(cr.get("user","email"),"cveal05@gmail.com")
414414

415+
deftest_config_with_quotes_with_literal_whitespace(self):
416+
cr=GitConfigParser(fixture_path("git_config_with_quotes_whitespace"),read_only=True)
417+
self.assertEqual(cr.get("core","commentString"),"# ")
418+
415419
deftest_get_values_works_without_requiring_any_other_calls_first(self):
416420
file_obj=self._to_memcache(fixture_path("git_config_multiple"))
417421
cr=GitConfigParser(file_obj,read_only=True)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp