Title: gitconfig: mnemonicPrefix conflict with create_patch · Issue #2013 · gitpython-developers/GitPython · GitHub
Open Graph Title: gitconfig: mnemonicPrefix conflict with create_patch · Issue #2013 · gitpython-developers/GitPython
X Title: gitconfig: mnemonicPrefix conflict with create_patch · Issue #2013 · gitpython-developers/GitPython
Description: the regex: GitPython/git/diff.py Line 372 in 6d09bb6 [ ](?P
Open Graph Description: the regex: GitPython/git/diff.py Line 372 in 6d09bb6 [ ](?P
X Description: the regex: GitPython/git/diff.py Line 372 in 6d09bb6 [ ](?P<a_path_fallback>"?[ab]/.+?"?)[ ](?P<b_path_fallback>"?[ab]/.+?"?)\n is not able to match the diff generat...
Opengraph URL: https://github.com/gitpython-developers/GitPython/issues/2013
X: @github
Domain: togithub.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"gitconfig: mnemonicPrefix conflict with create_patch","articleBody":"the regex:\n\nhttps://github.com/gitpython-developers/GitPython/blob/6d09bb610932d6081da7a516f8e7215414d953e5/git/diff.py#L372\n\nis not able to match the diff generated if this flag is enabled in `~/.gitconfig`:\n```\n[diff]\n mnemonicPrefix = true\n```\nbecause it is expecting `[ab]/` as folder prefix for the diff but with mnemonicPrefix enabled it become `[wc]/`\n\n### Diff without `mnemonicPrefix`\n```diff\ndiff --git a/.vscode/launch.json b/.vscode/launch.json\nindex xxxxxxx..xxxxxxxx\n--- a/.vscode/launch.json\n+++ b/.vscode/launch.json\n```\n\n### Diff with `mnemonicPrefix = true` \n```diff\ndiff --git c/.vscode/launch.json w/.vscode/launch.json\nindex xxxxxxx..xxxxxxxx\n--- c/.vscode/launch.json\n+++ w/.vscode/launch.json\n```\n\n### Quick Test\n```python\nrepo = git.Repo('.')\nbranch_ref = repo.head\nancestor_ref = repo.merge_base(branch_ref, repo.refs[\"main\"])\ndiff = ancestor_ref[0].diff(None, create_patch=True)\nprint(diff)\n```","author":{"url":"https://github.com/ceccopierangiolieugenio","@type":"Person","name":"ceccopierangiolieugenio"},"datePublished":"2025-03-12T16:38:38.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/2013/GitPython/issues/2013"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:06c64b85-3d46-b40e-5f5f-d6c6ecdca38d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EC1E:3410DA:F89B53:1413269:696B0B75 |
| html-safe-nonce | d64e48ab92c2825698d2d2c575300fc94071515325cac4ed8d051d507587e703 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQzFFOjM0MTBEQTpGODlCNTM6MTQxMzI2OTo2OTZCMEI3NSIsInZpc2l0b3JfaWQiOiI3MTM5MjkwODUxMjAzNTEwOTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7361da85fe59c33be2ad4d78a92b1a9597cf44e29ae33cee139094800f862518 |
| hovercard-subject-tag | issue:2914556951 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/gitpython-developers/GitPython/2013/issue_layout |
| twitter:image | https://opengraph.githubassets.com/88286969b3f4deaec2424edd00f55e68d1b5ff4952ed07de16e84e5ca292f78b/gitpython-developers/GitPython/issues/2013 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/88286969b3f4deaec2424edd00f55e68d1b5ff4952ed07de16e84e5ca292f78b/gitpython-developers/GitPython/issues/2013 |
| og:image:alt | the regex: GitPython/git/diff.py Line 372 in 6d09bb6 [ ](?P |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ceccopierangiolieugenio |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| go-import | github.com/gitpython-developers/GitPython git https://github.com/gitpython-developers/GitPython.git |
| octolytics-dimension-user_id | 503709 |
| octolytics-dimension-user_login | gitpython-developers |
| octolytics-dimension-repository_id | 1126087 |
| octolytics-dimension-repository_nwo | gitpython-developers/GitPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1126087 |
| octolytics-dimension-repository_network_root_nwo | gitpython-developers/GitPython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width