[BUG] resolving git URL with branch/tag
johngeorgewright opened this issue · 1 comments
johngeorgewright commented
What / Why
An error is thrown when resolving a git URL with a branch or tag.
How
Current Behavior
- Using
pacote.resolve()
with a git shortcode will return a string without resolving to a specific tag or branch - Using
pacote.resolve()
with a git shortcode will throw an Error when resolving to a specific tag or branch
Steps to Reproduce
> pacote.resolve('github:npm/libnpm').then(console.info, console.error)
"git+ssh://git@github.com/npm/libnpm.git#a10f50f71ad05bf51f478aafd8bf92e770c569ab"
> pacote.resolve('github:npm/libnpm#master').then(console.info, console.error)
Error: command failed
at ChildProcess.<anonymous> (.../npm-check-git/node_modules/@npmcli/promise-spawn/index.js:63:27)
at ChildProcess.emit (events.js:315:20)
at ChildProcess.EventEmitter.emit (domain.js:506:15)
at maybeClose (internal/child_process.js:1021:16)
at Socket.<anonymous> (internal/child_process.js:443:11)
at Socket.emit (events.js:315:20)
at Socket.EventEmitter.emit (domain.js:506:15)
at Pipe.<anonymous> (net.js:674:12)
at Pipe.callbackTrampoline (internal/async_hooks.js:120:14) {
cmd: '/usr/bin/git',
args: [
'clone',
'--mirror',
'-q',
'ssh://git@github.com/npm/libnpm.git',
'~/.npm/tmp/git-clone-2ffe14e8/.git'
],
code: 128,
signal: null,
stdout: '',
stderr: "fatal: destination path ~/.npm/tmp/git-clone-2ffe14e8/.git' already exists and is not an empty directory.\n"
}
Expected Behavior
- Using
pacote.resolve()
with a git shortcode should resolve a git+ssh URL whether using a tag/branch reference or not
johngeorgewright commented
It looks like this isn't actually a problem. What was happening was I trying to reference a "committish" "master" that didn't exist in the repo (they use "latest").
For anyone getting a similar error message, check you're pointing to a correct ref.