Skip to content

Fix #133 -- Handle git diff mnemonic prefixes#137

Merged
codingjoe merged 3 commits into
codingjoe:mainfrom
amureki:133/mnemonic-prefixes
Jun 9, 2026
Merged

Fix #133 -- Handle git diff mnemonic prefixes#137
codingjoe merged 3 commits into
codingjoe:mainfrom
amureki:133/mnemonic-prefixes

Conversation

@amureki

@amureki amureki commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Git diff headers may use prefixes other than a/ and b/, for example, when diff.mnemonicPrefix=true is configured:

diff --git c/file.py i/file.py

Relint now parses diff headers with arbitrary non-empty prefixes, so both --diff and --git-diff keep working with mnemonic/custom prefixes.

I added parser-level coverage and an integration regression test for --git-diff with diff.mnemonicPrefix=true.

Other references:

@amureki amureki assigned amureki and codingjoe and unassigned amureki Jun 9, 2026
@codingjoe

Copy link
Copy Markdown
Owner

Hm... is there an advantage for us to extend the parser instead of more closely defining the diff output?

@amureki

amureki commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator Author

Hm... is there an advantage for us to extend the parser instead of more closely defining the diff output?

Yeah, this is a good open question.
The reason I went with parser-side is that relint also supports --diff, where the diff comes from stdin.
In that mode, relint cannot control how git diff was invoked, so a user (like me) piping output from Git with diff.mnemonicPrefix=true / other custom prefixes would still hit the same parser issue.

We can force prefixes, but it will only fix own relint's calls. As long as we want to support git diff and all documented non-default prefixes, we'd need to deal with the parser extension...

But it is your call. :)

@codingjoe codingjoe linked an issue Jun 9, 2026 that may be closed by this pull request
Comment thread relint/parse.py Outdated
@amureki amureki requested a review from codingjoe June 9, 2026 14:05

@codingjoe codingjoe left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

@codingjoe codingjoe merged commit 49a477b into codingjoe:main Jun 9, 2026
8 checks passed
@amureki amureki deleted the 133/mnemonic-prefixes branch June 9, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Relint 3.4.0 throws ValueError

2 participants