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

Fix gitRange for git+ssh for private git #33

Merged
merged 2 commits into from
Apr 10, 2018
Merged

Fix gitRange for git+ssh for private git #33

merged 2 commits into from
Apr 10, 2018

Conversation

andreeib
Copy link
Contributor

@andreeib andreeib commented Mar 9, 2018

Reopened the previous pull request: #32
I haven't realized that git range works for hosted git like github.com but it doesn't for private git. Ex:

var npa = require("npm-package-arg");
try {
  var parsed = npa("git+ssh://git@github.com:npm/npm-package-arg.git#semver:~5.0.0");
  console.log(parsed.gitRange); // Works as expected: ~5.0.0
} catch (ex) {
  console.log(ex);
}
try {
  var parsed = npa("git+ssh://git@private.git.com:development/repositories.git#semver:~1.0.0");
  console.log(parsed.gitRange); // Dosen't work: undefined
} catch (ex) {
  console.log(ex);
}

@andreeib
Copy link
Contributor Author

So it seems private git semver doesn't work when using colon separator:

> require('.')("git+ssh://git@github.com/npm/npm-package-arg.git#semver:^5.1.0").gitRange
'^5.1.0'
> require('.')("git+ssh://git@github.com:npm/npm-package-arg.git#semver:^5.1.0").gitRange
'^5.1.0'
> require('.')("git+ssh://git@notgithub.com/npm/npm-package-arg.git#semver:^5.1.0").gitRange
'^5.1.0'
> require('.')("git+ssh://git@notgithub.com:npm/npm-package-arg.git#semver:^5.1.0").gitRange
undefined

Copy link
Contributor

@zkat zkat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Yeah, it sounds like I missed a spot when the semver stuff was added and/or when scp specs were fixed last time around. Thank you!

@zkat zkat merged commit a3ee426 into npm:master Apr 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants