From de9b6c20d4ea873735e8772dcb09490aa7c759d4 Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Tue, 18 Jul 2023 12:42:17 +0300 Subject: [PATCH] revert: "fix(git-resolver): wrong scheme to `git ls-remote` (#6806)" This reverts commit 6fe0b60e61aa7b0915cba713ace5652c3c841468. ref #6827 --- .changeset/good-goats-rest.md | 6 ++++++ resolving/git-resolver/src/parsePref.ts | 18 +++++++++--------- resolving/git-resolver/test/index.ts | 6 ++++-- 3 files changed, 19 insertions(+), 11 deletions(-) create mode 100644 .changeset/good-goats-rest.md diff --git a/.changeset/good-goats-rest.md b/.changeset/good-goats-rest.md new file mode 100644 index 0000000000..96c9caec4c --- /dev/null +++ b/.changeset/good-goats-rest.md @@ -0,0 +1,6 @@ +--- +"pnpm": patch +"@pnpm/git-resolver": patch +--- + +Temporarily revert the fix to [#6805](https://github.com/pnpm/pnpm/issues/6805) to fix the regression it caused [#6827](https://github.com/pnpm/pnpm/issues/6827). diff --git a/resolving/git-resolver/src/parsePref.ts b/resolving/git-resolver/src/parsePref.ts index 54ea67c4f4..d4f799da8e 100644 --- a/resolving/git-resolver/src/parsePref.ts +++ b/resolving/git-resolver/src/parsePref.ts @@ -61,10 +61,10 @@ function urlToFetchSpec (urlparse: URL) { return fetchSpec } -async function fromHostedGit (hosted: HostedGit): Promise { +async function fromHostedGit (hosted: any): Promise { // eslint-disable-line let fetchSpec: string | null = null // try git/https url before fallback to ssh url - const gitUrl = hosted.https({ noCommittish: true, noGitPlus: true }) ?? hosted.ssh({ noCommittish: true }) + const gitUrl = hosted.https({ noCommittish: true }) ?? hosted.ssh({ noCommittish: true }) if (gitUrl && await accessRepository(gitUrl)) { fetchSpec = gitUrl } @@ -77,11 +77,11 @@ async function fromHostedGit (hosted: HostedGit): Promise { fetchSpec: httpsUrl, hosted: { ...hosted, - _fill: (hosted as any)._fill, // eslint-disable-line @typescript-eslint/no-explicit-any + _fill: hosted._fill, tarball: undefined, - } as any, // eslint-disable-line @typescript-eslint/no-explicit-any + }, normalizedPref: `git+${httpsUrl}`, - ...setGitCommittish(hosted.committish!), + ...setGitCommittish(hosted.committish), } } else { try { @@ -111,11 +111,11 @@ async function fromHostedGit (hosted: HostedGit): Promise { fetchSpec: fetchSpec!, hosted: { ...hosted, - _fill: (hosted as any)._fill, // eslint-disable-line @typescript-eslint/no-explicit-any + _fill: hosted._fill, tarball: hosted.tarball, - } as any, // eslint-disable-line @typescript-eslint/no-explicit-any - normalizedPref: hosted.auth ? fetchSpec! : hosted.shortcut(), - ...setGitCommittish(hosted.committish!), + }, + normalizedPref: hosted.shortcut(), + ...setGitCommittish(hosted.committish), } } diff --git a/resolving/git-resolver/test/index.ts b/resolving/git-resolver/test/index.ts index ad254f3242..b0f7f8ee62 100644 --- a/resolving/git-resolver/test/index.ts +++ b/resolving/git-resolver/test/index.ts @@ -414,9 +414,11 @@ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\trefs/heads/master\ const resolveResult = await resolveFromGit({ pref: 'git+https://0000000000000000000000000000000000000000:x-oauth-basic@github.com/foo/bar.git' }) expect(resolveResult).toStrictEqual({ id: '0000000000000000000000000000000000000000+x-oauth-basic@github.com/foo/bar/0000000000000000000000000000000000000000', - normalizedPref: 'https://0000000000000000000000000000000000000000:x-oauth-basic@github.com/foo/bar.git', + normalizedPref: 'git+https://0000000000000000000000000000000000000000:x-oauth-basic@github.com/foo/bar.git', resolution: { - tarball: 'https://codeload.github.com/foo/bar/tar.gz/0000000000000000000000000000000000000000', + commit: '0000000000000000000000000000000000000000', + repo: 'https://0000000000000000000000000000000000000000:x-oauth-basic@github.com/foo/bar.git', + type: 'git', }, resolvedVia: 'git-repository', })