Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork941
Commitcd72d78
committed
Merge pull request#46 from ereOn/master
Incorrect handling of backslashes and quotes in GitConfigParserSteps to reproduce the issue:import gitconfig = 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/configIndeed, if you open .git/config you can see that the value is written as:[test] test = some\dataWhile 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.3 files changed
+56
-4
lines changedLines changed: 27 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
245 | 245 |
| |
246 | 246 |
| |
247 | 247 |
| |
248 |
| - | |
249 |
| - | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
250 | 270 |
| |
251 | 271 |
| |
252 | 272 |
| |
| |||
303 | 323 |
| |
304 | 324 |
| |
305 | 325 |
| |
306 |
| - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
307 | 331 |
| |
308 | 332 |
| |
309 | 333 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + |
Lines changed: 25 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
101 | 101 |
| |
102 | 102 |
| |
103 | 103 |
| |
104 |
| - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + |
0 commit comments
Comments
(0)