Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
cdimitroulas opened this issue Jun 8, 2018 · 3 comments
Closed

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

cdimitroulas opened this issue Jun 8, 2018 · 3 comments
Assignees
Labels

Comments

@cdimitroulas
Copy link

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 "git@github.com:cdimitroulas/test-repository.git".

Example package.json dependency:

"dependencies": {
    "test-module": "git+ssh://git@github.com: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://git@github.com: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)

@ghost ghost assigned rally25rs Jun 8, 2018
@ghost ghost added the triaged label Jun 8, 2018
@rally25rs
Copy link
Contributor

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

@rally25rs rally25rs added cat-bug and removed triaged labels Jun 9, 2018
rally25rs added a commit to rally25rs/yarn that referenced this issue Jun 9, 2018
rally25rs added a commit to rally25rs/yarn that referenced this issue Jun 9, 2018
Previously yarn was using a string split('#') to separate the URL from the branch name. If a branch
also had a hash in it, then the rest of the split chunks were ignored, meaning only the chunk before
the first '#' was used as the branch name. This change handles those URLs correctly, preserving the
'#'s in URL hashes.

yarnpkg#5954
@cdimitroulas
Copy link
Author

Brilliant, thanks a lot for the quick PR @rally25rs 😍

@rally25rs
Copy link
Contributor

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants