Commit 6ef056f
committed
Fix diff parsing to support mnemonicPrefix configuration
Fixes #2013
When diff.mnemonicPrefix=true is set in git config, git uses different
prefixes for diff paths instead of the standard a/ and b/:
- c/ for commit
- w/ for worktree
- i/ for index
- o/ for object
- h/ for HEAD
Previously, the diff regex and decode_path() function only accepted
a/ and b/ prefixes, causing create_patch=True diffs to fail parsing.
Changes:
- Update re_header regex to accept [abciwoh]/ prefixes
- Update decode_path() assertion to accept all valid mnemonic prefixes
- Add test case for mnemonicPrefix-style diffs1 parent eecc28d commit 6ef056f
2 files changed
+39
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
117 | 120 | | |
118 | 121 | | |
119 | 122 | | |
| |||
367 | 370 | | |
368 | 371 | | |
369 | 372 | | |
| 373 | + | |
| 374 | + | |
370 | 375 | | |
371 | 376 | | |
372 | 377 | | |
373 | | - | |
| 378 | + | |
374 | 379 | | |
375 | 380 | | |
376 | 381 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
284 | 316 | | |
285 | 317 | | |
286 | 318 | | |
| |||
0 commit comments