diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2012-05-30 05:30:51 -0700 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2012-05-30 05:30:51 -0700 |
commit | cd72d78e79271f0f9025984fb2d9a6c5b4dba4de (patch) | |
tree | 81d9629c6b6a2b3574f1d105b9b06e2c06b6d28f /git/diff.py | |
parent | 91c04a12e0d66dacaee81acc8c03e47afe4aafd9 (diff) | |
parent | 3cadd6f793f6c59fa3ad0d6e1a209d6b6b06b6da (diff) | |
download | gitpython-cd72d78e79271f0f9025984fb2d9a6c5b4dba4de.tar.gz |
Merge pull request #46 from ereOn/master
Incorrect handling of backslashes and quotes in GitConfigParser
Steps to reproduce the issue:
import git
config = git.Repo().config_writer()
config.add_section('test')
config.set_value('test', 'test', r'some\data')
Now if you try to read this value using a regular (non Python) git config, Git complains that the configuration file is invalid:
fatal: bad config file line 11 in .git/config
Indeed, if you open .git/config you can see that the value is written as:
[test]
test = some\data
While the git-config configuration states that:
String values may be entirely or partially enclosed in double quotes. You need to enclose variable values in double quotes if you want to preserve leading or trailing whitespace, or if the variable value contains comment characters (i.e. it contains # or ;). Double quote " and backslash \ characters in variable values must be escaped: use \" for " and \ for .
That is, the backslashes are not escaped in the configuration file.
This also causes issues while reading, because values are not un-escaped.
This pull request fixes both those issues and also fixes unescaped quotes pairs.
A test-case has been provided along with the fixes.
Diffstat (limited to 'git/diff.py')
0 files changed, 0 insertions, 0 deletions