Skip to content

Conversation

mstv
Copy link
Member

@mstv mstv commented Dec 5, 2023

Fixes #11424
Adapted version of #11425 for vNext

Proposed changes

  • Ignore fetch/push options in RemoteVerboseLineRegex used by GetRemotesAsync

Screenshots

N/A

Test methodology

  • extended testcase

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.

@mstv mstv self-assigned this Dec 5, 2023
Copy link
Member

@gerhardol gerhardol left a 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

@@ -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*\[[^\]]*])?$")]
Copy link
Member

Choose a reason for hiding this comment

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

Is the last \ optional?

Suggested change
[GeneratedRegex(@"^(?<name>[^ ]+)\t(?<url>.+?) \((?<direction>fetch|push)\)(?:(?# ignore trailing options)\s*\[[^\]]*])?$")]
[GeneratedRegex(@"^(?<name>[^ ]+)\t(?<url>.+?) \((?<direction>fetch|push)\)(?:(?# ignore trailing options)\s*\[[^\]]*\])?$")]

Copy link
Member Author

@mstv mstv Dec 5, 2023

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...?

Copy link
Member

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

Copy link
Member Author

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?

@RussKie RussKie added the 📭 needs: author feedback More info/confirmation awaited from OP; issues typically get closed after 30 days of inactivity label Dec 6, 2023
@ghost ghost removed the 📭 needs: author feedback More info/confirmation awaited from OP; issues typically get closed after 30 days of inactivity label Dec 6, 2023
@mstv mstv merged commit 16ff4c2 into gitextensions:master Dec 7, 2023
@ghost ghost added this to the vNext milestone Dec 7, 2023
@mstv mstv deleted the feature/i11424_remotes_with_options_ branch December 7, 2023 20:49
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.

[NBug] Unable to update remote pushurl for command output: origin ...
3 participants