-
-
Notifications
You must be signed in to change notification settings - Fork 966
Fix diff parsing to support mnemonicPrefix configuration #2092
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -281,6 +281,38 @@ def test_diff_unsafe_paths(self): | |||||||
| self.assertEqual(res[13].a_path, 'a/"with-quotes"') | ||||||||
| self.assertEqual(res[13].b_path, 'b/"with even more quotes"') | ||||||||
|
|
||||||||
| def test_diff_mnemonic_prefix(self): | ||||||||
| """Test that diff parsing works with mnemonicPrefix enabled. | ||||||||
| When diff.mnemonicPrefix=true is set in git config, git uses different | ||||||||
| prefixes for diff paths: | ||||||||
| - c/ for commit | ||||||||
| - w/ for worktree | ||||||||
| - i/ for index | ||||||||
| - o/ for object | ||||||||
|
||||||||
| - o/ for object | |
| - o/ for object | |
| - h/ for HEAD |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test only covers c/ and w/ prefixes but doesn't test the other valid mnemonicPrefix options (i/, o/, h/). Consider adding test cases for these prefixes as well to ensure the regex pattern [abciwoh] and the decode_path() function work correctly with all supported prefixes. This could be done either by adding more test data in this test or creating a parameterized test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment is missing the
h/prefix for HEAD. According to the PR description and the Git documentation,h/is also a valid mnemonicPrefix. The comment should list all supported prefixes: c/ (commit), w/ (worktree), i/ (index), o/ (object), and h/ (HEAD).