-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix(PatchProcessor): Fixup encoding for diff text #12091
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
Conversation
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.
Do we have any tests coving this regression?
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.
Good catch!
A weird range is still a range
fix(PatchProcessor): Fixup StartOfContentsRegex Refs: gitextensions#12091
fix(PatchProcessor): Fixup StartOfContentsRegex Similar for GetSubmodulesInfo() (in submodules form and Plugins for statistics). Refs: gitextensions#12091
@@ -39,7 +39,7 @@ private enum PatchProcessorState | |||
[GeneratedRegex(@$"(---|\+\+\+) [""]?[^/\s]+/(?<filename>.*)[""]?", RegexOptions.ExplicitCapture)] | |||
private static partial Regex FileNameRegex(); | |||
|
|||
[GeneratedRegex(@$"^({_escapeSequenceRegex})?[ -+@]", RegexOptions.ExplicitCapture)] | |||
[GeneratedRegex(@$"^({_escapeSequenceRegex})?[-+@ ]", RegexOptions.ExplicitCapture)] |
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.
To further clarify
[GeneratedRegex(@$"^({_escapeSequenceRegex})?[-+@ ]", RegexOptions.ExplicitCapture)] | |
[GeneratedRegex(@$"^({_escapeSequenceRegex})?[\-+@ ]", RegexOptions.ExplicitCapture)] |
I searched for other occurrences, found one other, with no importance.
Also some testcases.
Pushed to private branch, suggest it is included
Fixes #12066
Proposed changes
PatchProcessor.StartOfContentsRegex
: Move'-'
to first position inside"[ -+@]"
in order to avoid special meaning in regex.This made
CreatePatchFromString
choose the wrong encoding for removed line.Screenshots
Before
After
Test methodology
Merge strategy
I agree that the maintainer squash merge this PR (if the commit message is clear).
✒️ I contribute this code under The Developer Certificate of Origin.