Content-Length: 322576 | pFad | http://github.com/gitpython-developers/GitPython/pull/2047/files

71 Remove explicit empty `""` handling in ConfigParser by EliahKagan · Pull Request #2047 · gitpython-developers/GitPython · GitHub
Skip to content

Remove explicit empty "" handling in ConfigParser #2047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions git/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,9 +501,6 @@ def string_decode(v: str) -> str:
if pos != -1 and optval[pos - 1].isspace():
optval = optval[:pos]
optval = optval.strip()
if optval == '""':
optval = ""
# END handle empty string
optname = self.optionxform(optname.rstrip())
if len(optval) > 1 and optval[0] == '"' and optval[-1] != '"':
is_multi_line = True
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/git_config_with_empty_quotes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[core]
filemode = ""
4 changes: 4 additions & 0 deletions test/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,10 @@ def test_config_with_quotes(self):
self.assertEqual(cr.get("user", "name"), "Cody Veal")
self.assertEqual(cr.get("user", "email"), "cveal05@gmail.com")

def test_config_with_empty_quotes(self):
cr = GitConfigParser(fixture_path("git_config_with_empty_quotes"), read_only=True)
self.assertEqual(cr.get("core", "filemode"), "", "quotes can form a literal empty string as value")

def test_config_with_quotes_with_literal_whitespace(self):
cr = GitConfigParser(fixture_path("git_config_with_quotes_whitespace_inside"), read_only=True)
self.assertEqual(cr.get("core", "commentString"), "# ")
Expand Down
Loading








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/gitpython-developers/GitPython/pull/2047/files

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy