-
Notifications
You must be signed in to change notification settings - Fork 95
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
Bugfix - Correctly match package names from local repos #1731
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.
Looks good, just added a couple comments
foreach (string path in Directory.GetFiles(Repository.Uri.LocalPath)) | ||
{ | ||
string packageFullName = Path.GetFileName(path); | ||
MatchCollection matches = rx.Matches(packageFullName); | ||
if (matches.Count == 0) | ||
{ |
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.
It might be nice to add logging here saying no matches were found.
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.
this condition just means that as we're iterating through the files, if a file's name doesn't match it'll be reflected as matches.Count == 0
or even as groups.Count == 0
. So if we added logging here it may be a lot of logs. We do have a condition after this iteration of files completes, where if the package file path latestVersionPath
is empty and not set then we write an error.
… packageName* to avoid unwanted wildcard clashes
cc17fb5
to
98c6809
Compare
PR Summary
There was a bug in how we parse out name and version information from package file names when performing search against local repositories.
If you have a package
test
and test.submodule` present in the local repository their files will look like this:We used WildCardPattern class before, with pattern
{packageName}.*" which would pick up both packages if package
testwas searched for. The code logic then assumed the rest of the part of the name would be the version so it would search through both package names and try to parse
submodule.1.0.0` into a version.This fix uses Regex more accurately created for the package name and to expect a version right after the name, not text.
PR Context
Fixes #1641 #1648
PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.