fix(git-resolver): resolve commits via https (#4734)

This commit is contained in:
Zoltan Kochan
2022-05-14 23:14:22 +03:00
committed by GitHub
parent 4985aab3cf
commit 0fa446d106
2 changed files with 6 additions and 4 deletions

View File

@@ -0,0 +1,5 @@
---
"@pnpm/git-resolver": patch
---
Resolve commits from GitHub via https.

View File

@@ -77,10 +77,7 @@ function urlToFetchSpec (urlparse: URL) {
async function fromHostedGit (hosted: any): Promise<HostedPackageSpec> { // eslint-disable-line
let fetchSpec: string | null = null
// try git/https url before fallback to ssh url
// Note only GitHub has gitTemplate (git://...) in hosted-git-info, has to use
// sshTemplate (git@...) for bitbucket and gitlab.
const gitUrl = hosted.git({ noCommittish: true }) ?? hosted.ssh({ noCommittish: true })
const gitUrl = hosted.https({ noCommittish: true }) ?? hosted.ssh({ noCommittish: true })
if (gitUrl && await accessRepository(gitUrl)) {
fetchSpec = gitUrl
}