Skip to content
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

fix(resolver): Add general support for git-over-protocol URLs #4759

Merged
merged 3 commits into from
Oct 26, 2017

Conversation

knuton
Copy link
Contributor

@knuton knuton commented Oct 23, 2017

Summary

Yarn can not handle the git+https:// dependency format correctly, as described for various versions in #1625. The problem is present in Yarn 1.2.1.

A related problem for git+ssh:// has been described in #573 and fixed in #3425.

This PR extends the solution from #3425 to use the Git fetcher for any Git-over-protocol URLs.

Test plan

Extended the package-request unit tests to verify that the correct remote type (git) is used for git+https://, while the tarball remote type continues to be used for regular HTTP(S) URLs.

Copy link
Contributor

@rally25rs rally25rs left a comment

Choose a reason for hiding this comment

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

Nicely done. Thanks for adding tests too! 👍

@knuton
Copy link
Contributor Author

knuton commented Oct 25, 2017

Nice, thanks for greenlighting.

Just realized that I checked in changes to yarn.lock. That's probably a mistake, shall I remove those?

@BYK
Copy link
Member

BYK commented Oct 26, 2017

Just realized that I checked in changes to yarn.lock. That's probably a mistake, shall I remove those?

I took care of that for you ;)

I feel like this logic should be merged with the one I worked on at #4657. What do you two think?

@BYK BYK changed the title Add general support for git-over-protocol URLs fix(resolver): Add general support for git-over-protocol URLs Oct 26, 2017
@BYK BYK merged commit 7beaad0 into yarnpkg:master Oct 26, 2017
@knuton
Copy link
Contributor Author

knuton commented Oct 26, 2017

Thanks @BYK!

Your question prompted me to browse the Yarn codebase for a moment. Now my feeling is that this check should happen earlier, that is request.getLocked should already be called with the correct remoteType.

I just looked at some traces and I'd bet that Yarn picks the wrong resolver for certain patterns. Concretely in the project that was affected by this, Yarn looks for a resolver for the pattern multicast-dns@git+https://github.com/bnielsen1965/multicast-dns and ends up using the npm registry resolver which calls getLocked('tarball'). My familiarity with Yarn internals is too slight to tell whether the problem is with the Git resolver not claiming this, or with a pattern of this shape even getting to that point.

@knuton knuton deleted the git-over-protocols branch October 26, 2017 12:08
joaolucasl pushed a commit to joaolucasl/yarn that referenced this pull request Oct 27, 2017
…g#4759)

**Summary**

Yarn can not handle the `git+https://` dependency format correctly, as described for various versions in yarnpkg#1625. The problem is present in Yarn 1.2.1.

A related problem for `git+ssh://` has been described in yarnpkg#573 and fixed in yarnpkg#3425.

This PR extends the solution from yarnpkg#3425 to use the Git fetcher for any [Git-over-protocol](https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols) URLs.

**Test plan**

Extended the `package-request` unit tests to verify that the correct remote type (git) is used for `git+https://`, while the tarball remote type continues to be used for regular HTTP(S) URLs.
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.

3 participants