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

[BUG] package does not parse scp shorthand for gitlab properly when there are multiple nested subgroups.. #56

Closed
vivanov00 opened this issue Nov 14, 2019 · 1 comment

Comments

@vivanov00
Copy link

What / Why

If I pass in an scp shorthand url for gitlab.com with at least one group or subgroup, the package returns undefined.

Here is a reproduction via the node cli:

> var hostedGitInfo = require("hosted-git-info")
> var info = hostedGitInfo.fromUrl("git@gitlab.com:npm/path/to/something/hosted-git-info.git")
undefined
> typeof info
'undefined'
> var info = hostedGitInfo.fromUrl("ssh:git@gitlab.com:npm/path/to/something/hosted-git-info.git")
undefined
> typeof info
'object'
> 

My package details:

hosted-git-info version: 3.0.2
Node version: v10.17.0

When

Always.

Current Behavior

Should return a valid object when invoked, not undefined.

Steps to Reproduce

please see above.

Expected Behavior

Returns a valid object.

@wraithgar
Copy link
Member

This appears to work now

> x = hgi.fromUrl("git@gitlab.com:npm/path/to/something/hosted-git-info.git")
GitHost {
  sshtemplate: [Function: sshtemplate],
  sshurltemplate: [Function: sshurltemplate],
  browsetemplate: [Function: browsetemplate],
  browsefiletemplate: [Function: browsefiletemplate],
  docstemplate: [Function: docstemplate],
  httpstemplate: [Function: httpstemplate],
  filetemplate: [Function: filetemplate],
  shortcuttemplate: [Function: shortcuttemplate],
  pathtemplate: [Function: pathtemplate],
  bugstemplate: [Function: bugstemplate],
  hashformat: [Function: formatHashFragment],
  protocols: [ 'git+ssh:', 'git+https:', 'ssh:', 'https:' ],
  domain: 'gitlab.com',
  treepath: 'tree',
  tarballtemplate: [Function: tarballtemplate],
  extract: [Function: extract],
  type: 'gitlab',
  user: 'npm/path/to/something',
  auth: null,
  project: 'hosted-git-info',
  committish: '',
  default: 'sshurl',
  opts: {}
}
> x.ssh()
'git@gitlab.com:npm/path/to/something/hosted-git-info.git'

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

No branches or pull requests

2 participants