@pnpm/git-resolver
Advanced tools
Comparing version 5.0.2 to 5.1.0
# @pnpm/git-resolver | ||
## 5.1.0 | ||
### Minor Changes | ||
- 69ffc4099: It should be possible to install a Git-hosted dependency that names the default branch not "master". | ||
## 5.0.2 | ||
@@ -4,0 +10,0 @@ |
@@ -16,3 +16,3 @@ "use strict"; | ||
const pref = parsedSpec.gitCommittish == null || parsedSpec.gitCommittish === '' | ||
? 'master' | ||
? 'HEAD' | ||
: parsedSpec.gitCommittish; | ||
@@ -54,3 +54,6 @@ const commit = await resolveRef(parsedSpec.fetchSpec, pref, parsedSpec.gitRange); | ||
async function getRepoRefs(repo, ref) { | ||
const gitArgs = ['ls-remote', '--refs', repo]; | ||
const gitArgs = [repo]; | ||
if (ref !== 'HEAD') { | ||
gitArgs.unshift('--refs'); | ||
} | ||
if (ref) { | ||
@@ -60,7 +63,5 @@ gitArgs.push(ref); | ||
// graceful-git by default retries 10 times, reduce to single retry | ||
const result = await graceful_git_1.default(gitArgs, { retries: 1 }); | ||
const result = await graceful_git_1.default(['ls-remote', ...gitArgs], { retries: 1 }); | ||
const refs = result.stdout.split('\n').reduce((obj, line) => { | ||
const commitAndRef = line.split('\t'); | ||
const commit = commitAndRef[0]; | ||
const refName = commitAndRef[1]; | ||
const [commit, refName] = line.split('\t'); | ||
obj[refName] = commit; | ||
@@ -72,3 +73,3 @@ return obj; | ||
async function resolveRef(repo, ref, range) { | ||
if (ref.match(/^[0-9a-f]{40}$/) != null) { | ||
if (ref.match(/^[0-9a-f]{7,40}$/) != null) { | ||
return ref; | ||
@@ -75,0 +76,0 @@ } |
{ | ||
"name": "@pnpm/git-resolver", | ||
"version": "5.0.2", | ||
"version": "5.1.0", | ||
"description": "Resolver for git-hosted packages", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24054
295