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 support for private git repos when using shorted repo syntax and lock file exists #3425

Merged
merged 1 commit into from May 19, 2017

Conversation

ramasilveyra
Copy link
Contributor

@ramasilveyra ramasilveyra commented May 16, 2017

Description based on #573 (comment)

#2992 added support for private git repos when using shorted repo syntax (this landed on v0.24.0).

The generation for the first time of a yarn.lock file works well, but then with a yarn.lock file if you try rm -rf node_modules && yarn fails with this error:

error An unexpected error occurred: "Invalid protocol: git+ssh:".

That error comes from https://github.com/request/request/blob/b12a6245d9acdb1e13c6486d427801e123fdafae/request.js#L455 and I think it's because yarn tries to use the tarball fetcher instead of the git fetcher.

The offline feature/fix added recently makes the git resolver defaults to the tarball to avoid http calls https://github.com/yarnpkg/yarn/pull/3000/files
Returning the git shrunk instead of the tarball if is possible seems to fix the issue.

@bestander
Copy link
Member

@arcanis is the best to review this.
@ramasilveyra any idea of a unit/e2e test that will cover it?

@ramasilveyra
Copy link
Contributor Author

ramasilveyra commented May 16, 2017

@bestander this night (Argentina time) I can add the tests (maybe I will need to move the get shrunk logic to a new method getShrunk() to make the unit test). In the meantime feedback if this solution it's fine will be great @arcanis 😄 and if not how will you solve it?

@ramasilveyra ramasilveyra force-pushed the fix-private-deps branch 4 times, most recently from 3977ebd to 6a0ccb9 Compare May 17, 2017 07:31
…lock file exists

Force git remote type if the resolved url it's a git private url.
@ramasilveyra
Copy link
Contributor Author

Unit tests added! Solution change: issue fixed directly on the method this.request.getLocked().

@bestander bestander merged commit eac179c into yarnpkg:master May 19, 2017
@bestander
Copy link
Member

Thanks, @ramasilveyra

@ramasilveyra ramasilveyra deleted the fix-private-deps branch May 19, 2017 14:43
BYK pushed a commit that referenced this pull request Oct 26, 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](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.
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.

None yet

2 participants