-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Ignore fetch/push options in configuration of remote repos #11429
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
Ignore fetch/push options in configuration of remote repos #11429
Conversation
used by GetRemotesAsync
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.
assume regex is fixed if needed
GitCommands/Git/GitModule.cs
Outdated
@@ -58,7 +58,7 @@ public sealed partial class GitModule : IGitModule | |||
[GeneratedRegex(@"^(?<objectid>[0-9a-f]{40}) (?<origlinenum>\d+) (?<finallinenum>\d+)")] | |||
private static partial Regex HeaderRegex(); | |||
|
|||
[GeneratedRegex(@"^(?<name>[^ ]+)\t(?<url>.+?) \((?<direction>fetch|push)\)$")] | |||
[GeneratedRegex(@"^(?<name>[^ ]+)\t(?<url>.+?) \((?<direction>fetch|push)\)(?:(?# ignore trailing options)\s*\[[^\]]*])?$")] |
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.
Is the last \ optional?
[GeneratedRegex(@"^(?<name>[^ ]+)\t(?<url>.+?) \((?<direction>fetch|push)\)(?:(?# ignore trailing options)\s*\[[^\]]*])?$")] | |
[GeneratedRegex(@"^(?<name>[^ ]+)\t(?<url>.+?) \((?<direction>fetch|push)\)(?:(?# ignore trailing options)\s*\[[^\]]*\])?$")] |
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.
Obviously, the '\' is optional if want to match a single ']'. Otherwise, the test would have failed for the same regex as used in the release branch commit.
I have just moved the comment into the regex.
I agree, it might be clearer with ']'.
As we are discussing this regex, it contains a tab.
Can we change it to @"^(?<name>\S+)\t...
or @"^(?<name>[^ \t]+)\t...
?
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.
(Edited above) Answer to my question: ]
do not need to be escaped, except in []
Suggest to use \S
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.
]
must not be escaped.
Suggest to use \S
I had already pushed the one-to-one replacement @"^(?<name>[^\t]+)\t...
Should I change to \S
yet?
revert backslash
Fixes #11424
Adapted version of #11425 for vNext
Proposed changes
RemoteVerboseLineRegex
used byGetRemotesAsync
Screenshots
N/A
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.