Yarn: Unable to install a branch with a # in the name with git+ssh

Created on 8 Jun 2018  ·  3Comments  ·  Source: yarnpkg/yarn

Do you want to request a feature or report a bug?
This is a bug report.

What is the current behavior?
When running yarn install when package.json contains a dependency which uses a git+ssh url and
specifies a branch name with a # in the name (common for tracking issues) the installation fails with the following error:

error Couldn't find match for "issue-" in "refs/heads/issue-#1,refs/heads/master" for "[email protected]:cdimitroulas/test-repository.git".

Example package.json dependency:

"dependencies": {
    "test-module": "git+ssh://[email protected]:cdimitroulas/test-repository.git#issue-#1"
  }

If the current behavior is a bug, please provide the steps to reproduce.

  1. Create an new repo and initialise with npm init -y.
  2. Create the following package.json:
{
  "name": "yarn-bug",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "test-module": "git+ssh://[email protected]:cdimitroulas/test-repository.git#issue-#1"
  }
}
  1. Run yarn install

What is the expected behavior?
yarn install should install my module from the specified branch.

Please mention your node.js, yarn and operating system version.
npm - 6.1.0
yarn - 1.7.0
os - Ubuntu 16.04 (x64)

cat-bug

All 3 comments

Confirmed on v1.7.0. I'll see if I can work up a PR for this today...

Brilliant, thanks a lot for the quick PR @rally25rs :heart_eyes:

Discovered that this is a duplicate of #4880 which already had a different PR #4881 open to fix it. Going to close this issue as a duplicate and close my PR since it's the same as the one that already existed. There is some discussion in #4881 as to whether or not we should support this syntax at all...

Was this page helpful?
0 / 5 - 0 ratings