Title: Fix diff parsing to support mnemonicPrefix configuration by MirrorDNA-Reflection-Protocol · Pull Request #2092 · gitpython-developers/GitPython · GitHub
Open Graph Title: Fix diff parsing to support mnemonicPrefix configuration by MirrorDNA-Reflection-Protocol · Pull Request #2092 · gitpython-developers/GitPython
X Title: Fix diff parsing to support mnemonicPrefix configuration by MirrorDNA-Reflection-Protocol · Pull Request #2092 · gitpython-developers/GitPython
Description: Summary 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 when users had this config enabled. Reproduction As described in #2013: # With ~/.gitconfig containing: # [diff] # mnemonicPrefix = true repo = git.Repo('.') ancestor_ref = repo.merge_base(repo.head, repo.refs['main']) diff = ancestor_ref[0].diff(None, create_patch=True) # Would fail to parse Changes Update re_header regex to accept [abciwoh]/ prefixes instead of just [ab]/ Update decode_path() assertion to accept all valid mnemonic prefixes Add test case for mnemonicPrefix-style diffs Testing New test test_diff_mnemonic_prefix verifies parsing works with c/ and w/ prefixes All existing diff tests pass (except one pre-existing failure on main unrelated to this change) References Git documentation: https://git-scm.com/docs/git-config#Documentation/git-config.txt-diffmnemonicPrefix Issue: #2013
Open Graph Description: Summary 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/ ...
X Description: Summary 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/ ...
Opengraph URL: https://github.com/gitpython-developers/GitPython/pull/2092
X: @github
Domain: togithub.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:9f107a00-1a79-7b6b-73a6-9481f2993b00 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | DD78:1D1048:5C9787:812D06:69690219 |
| html-safe-nonce | 98c429fbacf21e1878ad8d34ae25cd9a6b52027b1f66014beca606816029ecdd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERDc4OjFEMTA0ODo1Qzk3ODc6ODEyRDA2OjY5NjkwMjE5IiwidmlzaXRvcl9pZCI6IjY5ODQyMTMyMzI4MTMxNDY2NDkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 558bd97b478c34dd2cf7ab721d9cdbab494a468297d6ae7a81551a40c975bde5 |
| hovercard-subject-tag | pull_request:3079243292 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/gitpython-developers/GitPython/pull/2092/files |
| twitter:image | https://avatars.githubusercontent.com/u/239564541?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/239564541?s=400&v=4 |
| og:image:alt | Summary 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/ ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | e6156bd4ef9f2dc8dadf4c49a8f7ed8532186388cef72eda3ccb9f0ab3b8cfca |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | fd1938215b152e2c6a29cf56fec07fd9f91f1203 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width