-
Notifications
You must be signed in to change notification settings - Fork 1k
Address mixup between bzr revisions and semver suffixes #869
Conversation
This commit addresses an issue where the godep importer would confuse semver suffixes for being bzr revisions. Now we have stricter checks on the bzr revision checks which will be able to distinguish between semver with a suffix and a bzr revision. The new check enforces bzr revisions to contain an @ symbol. Closes golang#827.
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
I signed it! |
CLAs look good, thanks! |
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.
Hurray! This is a great fix and I'm glad y'all found the real root cause of the bug.
@@ -479,7 +479,7 @@ func (sm *SourceMgr) InferConstraint(s string, pi ProjectIdentifier) (Constraint | |||
// Next, try for bzr, which has a three-component GUID separated by | |||
// dashes. There should be two, but the email part could contain | |||
// internal dashes | |||
if strings.Count(s, "-") >= 2 { | |||
if strings.Contains(s, "@") && strings.Count(s, "-") >= 2 { |
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.
🎉 Nice catch!
internal/gps/source_manager_test.go
Outdated
@@ -24,10 +24,16 @@ func TestSourceManager_InferConstraint(t *testing.T) { | |||
t.Fatal(err) | |||
} | |||
|
|||
svs, err := NewSemverConstraintIC(">=0.12.0, <=12.0.0-de4dcafe0") |
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.
nit: Let's change this to NewSemverConstraintIC("v0.12.0-12-de4dcafe0")
.
Thanks for the review, @carolynvs. I'll address your comments. |
@carolynvs I have addressed your comment in commit a2c11c7 🙇 |
@sebdah Thank you for the fix! 🎉 💖 |
What does this do / why do we need it?
This PR handles the case in the
godep_importer
where the imported dependency is referencing a semantic version with a suffix. E.g.Will now become:
What should your reviewer look out for in this PR?
As per my understanding it is fine to assume that
bzr
revisions contain@
symbols. But I'm not abzr
user so I'm half guessing (with some reading on the Internet) that it's valid.Do you need help or clarification on anything?
I think I've gotten what I needed in #827.
There was a comment in the code that I modified that was a bit too long. I have wrapped it. Don't know if you'd like to keep such things out of the PR. Let me know and I can drop that commit, no biggie 😄 .
Which issue(s) does this PR fix?
fixes #827