-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(resolver): Add general support for git-over-protocol URLs (#4759)
**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.
- Loading branch information
Showing
2 changed files
with
30 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ async function prepareRequest(pattern: string, version: string, resolved: string | |
return {request, reporter}; | ||
} | ||
|
||
test('Produce valid remote type for a git private dep', async () => { | ||
test('Produce valid remote type for a git-over-ssh dep', async () => { | ||
const {request, reporter} = await prepareRequest( | ||
'private-dep@github:yarnpkg/private-dep#1.0.0', | ||
'1.0.0', | ||
|
@@ -45,6 +45,32 @@ test('Produce valid remote type for a git private dep', async () => { | |
await reporter.close(); | ||
}); | ||
|
||
test('Produce valid remote type for a git-over-https dep', async () => { | ||
const {request, reporter} = await prepareRequest( | ||
'public-dep@yarnpkg/public-dep#1.0.0', | ||
'1.0.0', | ||
'git+https://github.com/yarnpkg/public-dep#1fde368', | ||
); | ||
|
||
expect(request.getLocked('git')._remote.type).toBe('git'); | ||
expect(request.getLocked('tarball')._remote.type).toBe('git'); | ||
|
||
await reporter.close(); | ||
}); | ||
|
||
test('Produce valid remote type for a git public dep', async () => { | ||
const {request, reporter} = await prepareRequest( | ||
'public-dep@yarnpkg/public-dep#1fde368', | ||
'1.0.0', | ||
'https://codeload.github.com/yarnpkg/public-dep/tar.gz/1fde368', | ||
); | ||
|
||
expect(request.getLocked('git')._remote.type).toBe('git'); | ||
expect(request.getLocked('tarball')._remote.type).toBe('tarball'); | ||
|
||
await reporter.close(); | ||
}); | ||
|
||
test('Check parentNames flowing in the request', async () => { | ||
const {request: parentRequest, reporter: parentReporter} = await prepareRequest( | ||
'[email protected]', | ||
|
@@ -63,16 +89,3 @@ test('Check parentNames flowing in the request', async () => { | |
await parentReporter.close(); | ||
await childReporter.close(); | ||
}); | ||
|
||
test('Produce valid remote type for a git public dep', async () => { | ||
const {request, reporter} = await prepareRequest( | ||
'public-dep@yarnpkg/public-dep#1fde368', | ||
'1.0.0', | ||
'https://codeload.github.com/yarnpkg/public-dep/tar.gz/1fde368', | ||
); | ||
|
||
expect(request.getLocked('git')._remote.type).toBe('git'); | ||
expect(request.getLocked('tarball')._remote.type).toBe('tarball'); | ||
|
||
await reporter.close(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters