Skip to content

Commit

Permalink
revert: "fix(git-resolver): wrong scheme to git ls-remote (#6806)"
Browse files Browse the repository at this point in the history
This reverts commit 6fe0b60.

ref #6827
  • Loading branch information
zkochan committed Jul 18, 2023
1 parent 9c2a7b3 commit c82f6c7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/good-goats-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"pnpm": 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).
18 changes: 9 additions & 9 deletions resolving/git-resolver/src/parsePref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ function urlToFetchSpec (urlparse: URL) {
return fetchSpec
}

async function fromHostedGit (hosted: HostedGit): Promise<HostedPackageSpec> {
async function fromHostedGit (hosted: any): Promise<HostedPackageSpec> { // 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
}
Expand All @@ -77,11 +77,11 @@ async function fromHostedGit (hosted: HostedGit): Promise<HostedPackageSpec> {
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 {
Expand Down Expand Up @@ -111,11 +111,11 @@ async function fromHostedGit (hosted: HostedGit): Promise<HostedPackageSpec> {
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),
}
}

Expand Down
6 changes: 4 additions & 2 deletions resolving/git-resolver/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
})
Expand Down

0 comments on commit c82f6c7

Please sign in to comment.