Skip to content

Preserve quoted leading and trailing single-line config var whitespace #2036

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 7, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Preserve quoted leading and trailing single-line whitespace
At least in a single line, whitespace in a double-quoted value in a
configuration file, like `name = " abc def "`, would presumably be
intended. This removes the `strip()` call that is applied to text
`ConfigParser` obtained by removing the double quotes around it.

This slightly refines the changes in #2035 by dropping the `strip()`
call while continuing to remove opening and closing double quotes.
  • Loading branch information
EliahKagan committed Jun 7, 2025
commit bd2b930503ad5d97322aa81d7610ab743d915f84
2 changes: 1 addition & 1 deletion git/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ def string_decode(v: str) -> str:
is_multi_line = True
optval = string_decode(optval[1:])
elif len(optval) > 1 and optval[0] == '"' and optval[-1] == '"':
optval = optval[1:-1].strip()
optval = optval[1:-1]
# END handle multi-line
# Preserves multiple values for duplicate optnames.
cursect.add(optname, optval)
Expand Down
Loading