Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: npm/hosted-git-info
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.6.0
Choose a base ref
...
head repository: npm/hosted-git-info
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.8.9
Choose a head ref

Commits on Jul 6, 2018

  1. fix(Revert): "git-host: fix forgotten extend()"

    This reverts commit eba1f7b.
    iarna committed Jul 6, 2018
    Copy the full SHA
    a815ec9 View commit details
  2. fix(Revert): "compat: remove Object.assign fallback (#25)"

    This reverts commit 627ab55.
    iarna committed Jul 6, 2018
    1
    Copy the full SHA
    cce5a62 View commit details
  3. 2.6.1

    iarna committed Jul 6, 2018
    Copy the full SHA
    cd2c54f View commit details
  4. fix(github tarball): update github tarballtemplate

    The old tarball url generates a 302 redirect to https://codeload.github.com, it's troublesome for tools (like curl) which do not automatically follow redirect response.
    
    Fixes: #34
    Credit: @huochunpeng
    3cp authored and iarna committed Jul 6, 2018
    Copy the full SHA
    6efd582 View commit details
  5. Copy the full SHA
    701bcd1 View commit details
  6. feat(all): Support www. prefixes on hostnames

    Fixes: #32
    iarna committed Jul 6, 2018
    1
    Copy the full SHA
    3349575 View commit details
  7. chore: Update travis config

    iarna committed Jul 6, 2018
    Copy the full SHA
    48b7aec View commit details
  8. chore: Update tap and standard

    iarna committed Jul 6, 2018
    Copy the full SHA
    1050792 View commit details
  9. chore(release): 2.7.0

    iarna committed Jul 6, 2018
    Copy the full SHA
    b7b18a9 View commit details

Commits on Jul 7, 2018

  1. fix(parse): Crash on strings that parse to having no host

    Fixes: #35
    Erveon authored and iarna committed Jul 7, 2018
    2
    Copy the full SHA
    c931482 View commit details
  2. Copy the full SHA
    5bc580d View commit details
  3. chore(release): 2.7.1

    iarna committed Jul 7, 2018
    Copy the full SHA
    ab35a90 View commit details

Commits on Jan 25, 2019

  1. comittish -> committish (#42)

    Seems some of the instances did not get replaced in #c4aa65618ec8b5eeb77ab2893a918746f0deeaf8
    
    Credit: @OiYouYeahYou
    OiYouYeahYou authored and aeschright committed Jan 25, 2019
    Copy the full SHA
    067fd7f View commit details

Commits on Aug 4, 2019

  1. update package-lock.json

    isaacs committed Aug 4, 2019
    Copy the full SHA
    5476dce View commit details
  2. Copy the full SHA
    1942b17 View commit details
  3. fix(cache): Switch to lru-cache to save ourselves from unlimited memo…

    …ry consumption
    
    PR-URL: #38
    Credit: @iarna
    Close: #38
    Reviewed-by: @isaacs
    iarna authored and isaacs committed Aug 4, 2019
    Copy the full SHA
    e518222 View commit details
  4. fix: do not allow invalid gist urls

    Gists are either name/hex{32}, or just /hex{32}.
    
    If someone omits the project, and just specifies a name, then that is an
    error and should be treated as such.
    
    Also, eliminate some dead code paths and bring the tests up to 100%.
    isaacs committed Aug 4, 2019
    Copy the full SHA
    d5cf830 View commit details
  5. fix(gitlab): Do not URL encode slashes in project name for GitLab htt…

    …ps URL
    
    PR-URL: #47
    Credit: @mterrel
    Close: #47
    Reviewed-by: @isaacs
    mterrel authored and isaacs committed Aug 4, 2019
    Copy the full SHA
    cbf04f9 View commit details
  6. Copy the full SHA
    cca4ddd View commit details
  7. test: turn off --esm

    isaacs committed Aug 4, 2019
    Copy the full SHA
    b681019 View commit details
  8. fix(git-host): disallow URI-encoded slash (%2F) in path

    PR-URL: #44
    Credit: @ybiquitous
    Close: #44
    Reviewed-by: @isaacs
    ybiquitous authored and isaacs committed Aug 4, 2019
    Copy the full SHA
    3776fa5 View commit details
  9. inline util._extend, rather than requiring util

    Related:
    - #25
    - #40
    
    This removes the require('util') fallback for Object.assign, without
    dropping support for node v4 (which will happen on the next major,
    likely along with 6), but gets bundle sizes down in the meantime.
    isaacs committed Aug 4, 2019
    Copy the full SHA
    a5a91ac View commit details
  10. feat: give these objects a name

    It's much less friendly to use this library (and those that depend on
    it, like npm-package-arg) when it's not clear whether the returned value
    is a member of a class (which likely has some useful methods) or just an
    object full of data that the user is expected to know what to do with.
    
    This is especially vexing since some of this sort of data is saved to
    various lock and config files, so _sometimes_ a thing that looks
    suspiciously like a GitHost object actually is just a plain old JS
    object.
    isaacs committed Aug 4, 2019
    Copy the full SHA
    60abaea View commit details
  11. fix: Allow slashes in gitlab project section

    Technically these are called groups and subgroups in GitLab parlance,
    but effectively, it means that a GitLab project url can have a path with
    unlimited portions, like company/property/team/component.git.
    
    This allows passing in unlimited path portions in the full url, and
    avoids encoding the `project` section akin to how `path` is treated as
    of 3776fa5 #44
    
    Fix #46
    Fix #43
    isaacs committed Aug 4, 2019
    Copy the full SHA
    bbcf7b2 View commit details

Commits on Aug 5, 2019

  1. chore(release): 2.8.0

    isaacs committed Aug 5, 2019
    Copy the full SHA
    8973221 View commit details
  2. fix: use gist tarball url that works for anonymous gists

    Also, this saves an extra 302 redirect on every gist tarball request.
    isaacs committed Aug 5, 2019
    Copy the full SHA
    1692435 View commit details
  3. fix: ignore noCommittish on tarball url generation

    Omitting the committish breaks every host's tarball serving
    capabilities.
    
    Just override that setting.
    isaacs committed Aug 5, 2019
    Copy the full SHA
    5d4a8d7 View commit details
  4. chore(release): 2.8.1

    isaacs committed Aug 5, 2019
    Copy the full SHA
    2d5aa25 View commit details
  5. fix: http protocol use sshurl by default

    PR-URL: #48
    Credit: @fengmk2
    Close: #48
    Reviewed-by: @isaacs
    fengmk2 authored and isaacs committed Aug 5, 2019
    Copy the full SHA
    3b1d629 View commit details
  6. chore(release): 2.8.2

    isaacs committed Aug 5, 2019
    Copy the full SHA
    96a49ea View commit details

Commits on Aug 12, 2019

  1. Revert "fix(cache): Switch to lru-cache to save ourselves from unlimi…

    …ted memory consumption"
    
    This reverts commit e518222.
    
    #38 (comment)
    
    Will un-revert in semver-major bump.
    isaacs committed Aug 12, 2019
    Copy the full SHA
    4f193b3 View commit details
  2. chore(release): 2.8.3

    isaacs committed Aug 12, 2019
    Copy the full SHA
    cbf63b7 View commit details
  3. Copy the full SHA
    f392f82 View commit details
  4. Copy the full SHA
    2070453 View commit details
  5. chore(release): 2.8.4

    isaacs committed Aug 12, 2019
    Copy the full SHA
    3d1ad71 View commit details

Commits on Sep 27, 2019

  1. test: added default fixtures and github specific fixtures

    Michael Perrotte committed Sep 27, 2019
    Copy the full SHA
    888f9b4 View commit details
  2. test: added refactered tests for gists

    Michael Perrotte committed Sep 27, 2019
    Copy the full SHA
    53364f9 View commit details
  3. fix: updated pathmatch for gitlab

    Michael Perrotte committed Sep 27, 2019
    Copy the full SHA
    ffe056f View commit details
  4. test: added basic test for ._fill() method

    Michael Perrotte committed Sep 27, 2019
    Copy the full SHA
    921e6dd View commit details

Commits on Sep 28, 2019

  1. test: added ignore; for 100% testing (this seems wonky)

    Michael Perrotte committed Sep 28, 2019
    Copy the full SHA
    1fd9d66 View commit details
  2. test: added refactered tests for bitbucket

    Michael Perrotte committed Sep 28, 2019
    Copy the full SHA
    8d24551 View commit details
  3. test: moved all github url tests together

    Michael Perrotte committed Sep 28, 2019
    Copy the full SHA
    ba44d9f View commit details
  4. test: removed unused testing structure

    Michael Perrotte committed Sep 28, 2019
    Copy the full SHA
    4eb69eb View commit details
  5. test: added script to get coverage report

    Michael Perrotte committed Sep 28, 2019
    Copy the full SHA
    4e4ea0f View commit details

Commits on Oct 7, 2019

  1. fix: updated pathmatch for gitlab

    PR-URL: #51
    Credit: @mikemimik
    Close: #51
    Reviewed-by: @isaacs
    claudiahdz authored and isaacs committed Oct 7, 2019
    1
    Copy the full SHA
    e8325b5 View commit details
  2. chore(release): 2.8.5

    isaacs committed Oct 7, 2019
    Copy the full SHA
    624fd6f View commit details

Commits on Feb 25, 2020

  1. Ensure passwords in hosted Git URLs are correctly escaped

    PR-URL: #58
    Credit: @stevenhilder
    Close: #58
    Reviewed-by: @darcyclarke
    stevenhilder authored and darcyclarke committed Feb 25, 2020
    2
    Copy the full SHA
    ff259a6 View commit details
  2. chore(release): 2.8.6

    darcyclarke committed Feb 25, 2020
    Copy the full SHA
    e1b83df View commit details

Commits on Feb 26, 2020

  1. fix: Do not pass scp-style URLs to the WhatWG url.URL

    Fix #60 (for the legacy branch)
    isaacs committed Feb 26, 2020
    Copy the full SHA
    f2cdfcf View commit details
  2. fix: Do not attempt to use url.URL when unavailable

    Fix #61
    
    This should not be ported to the latest branch, as Node.js v6 support
    was dropped there anyway.
    
    PR-URL: #62
    Credit: @isaacs
    Close: #62
    Reviewed-by: @isaacs
    isaacs committed Feb 26, 2020
    Copy the full SHA
    2d0bb66 View commit details
Showing with 4,332 additions and 3,137 deletions.
  1. +3 −2 .travis.yml
  2. +134 −0 CHANGELOG.md
  3. +6 −5 git-host-info.js
  4. +42 −15 git-host.js
  5. +42 −15 index.js
  6. +2,525 −2,903 package-lock.json
  7. +8 −10 package.json
  8. +26 −0 test/auth.js
  9. +15 −0 test/basic.js
  10. +0 −27 test/bitbucket-https-with-embedded-auth.js
  11. +283 −16 test/bitbucket.js
  12. +99 −0 test/fixtures/bitbucket.js
  13. +60 −0 test/fixtures/gist.js
  14. +38 −0 test/fixtures/github.js
  15. +22 −0 test/fixtures/gitlab-subgroups.js
  16. +99 −0 test/fixtures/gitlab.js
  17. +99 −0 test/fixtures/index.js
  18. +239 −30 test/gist.js
  19. +324 −30 test/github.js
  20. +268 −16 test/gitlab.js
  21. +0 −41 test/https-with-inline-auth.js
  22. +0 −27 test/lib/standard-tests.js
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: node_js
sudo: false
node_js:
- "7"
- "12"
- "10"
- "8"
- "6"
- "4"
134 changes: 134 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,140 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

<a name="2.8.9"></a>
## [2.8.9](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9) (2021-04-07)


### Bug Fixes

* backport regex fix from [#76](https://github.com/npm/hosted-git-info/issues/76) ([29adfe5](https://github.com/npm/hosted-git-info/commit/29adfe5)), closes [#84](https://github.com/npm/hosted-git-info/issues/84)



<a name="2.8.8"></a>
## [2.8.8](https://github.com/npm/hosted-git-info/compare/v2.8.7...v2.8.8) (2020-02-29)


### Bug Fixes

* [#61](https://github.com/npm/hosted-git-info/issues/61) & [#65](https://github.com/npm/hosted-git-info/issues/65) addressing issues w/ url.URL implmentation which regressed node 6 support ([5038b18](https://github.com/npm/hosted-git-info/commit/5038b18)), closes [#66](https://github.com/npm/hosted-git-info/issues/66)



<a name="2.8.7"></a>
## [2.8.7](https://github.com/npm/hosted-git-info/compare/v2.8.6...v2.8.7) (2020-02-26)


### Bug Fixes

* Do not attempt to use url.URL when unavailable ([2d0bb66](https://github.com/npm/hosted-git-info/commit/2d0bb66)), closes [#61](https://github.com/npm/hosted-git-info/issues/61) [#62](https://github.com/npm/hosted-git-info/issues/62)
* Do not pass scp-style URLs to the WhatWG url.URL ([f2cdfcf](https://github.com/npm/hosted-git-info/commit/f2cdfcf)), closes [#60](https://github.com/npm/hosted-git-info/issues/60)



<a name="2.8.6"></a>
## [2.8.6](https://github.com/npm/hosted-git-info/compare/v2.8.5...v2.8.6) (2020-02-25)



<a name="2.8.5"></a>
## [2.8.5](https://github.com/npm/hosted-git-info/compare/v2.8.4...v2.8.5) (2019-10-07)


### Bug Fixes

* updated pathmatch for gitlab ([e8325b5](https://github.com/npm/hosted-git-info/commit/e8325b5)), closes [#51](https://github.com/npm/hosted-git-info/issues/51)
* updated pathmatch for gitlab ([ffe056f](https://github.com/npm/hosted-git-info/commit/ffe056f))



<a name="2.8.4"></a>
## [2.8.4](https://github.com/npm/hosted-git-info/compare/v2.8.3...v2.8.4) (2019-08-12)



<a name="2.8.3"></a>
## [2.8.3](https://github.com/npm/hosted-git-info/compare/v2.8.2...v2.8.3) (2019-08-12)



<a name="2.8.2"></a>
## [2.8.2](https://github.com/npm/hosted-git-info/compare/v2.8.1...v2.8.2) (2019-08-05)


### Bug Fixes

* http protocol use sshurl by default ([3b1d629](https://github.com/npm/hosted-git-info/commit/3b1d629)), closes [#48](https://github.com/npm/hosted-git-info/issues/48)



<a name="2.8.1"></a>
## [2.8.1](https://github.com/npm/hosted-git-info/compare/v2.8.0...v2.8.1) (2019-08-05)


### Bug Fixes

* ignore noCommittish on tarball url generation ([5d4a8d7](https://github.com/npm/hosted-git-info/commit/5d4a8d7))
* use gist tarball url that works for anonymous gists ([1692435](https://github.com/npm/hosted-git-info/commit/1692435))



<a name="2.8.0"></a>
# [2.8.0](https://github.com/npm/hosted-git-info/compare/v2.7.1...v2.8.0) (2019-08-05)


### Bug Fixes

* Allow slashes in gitlab project section ([bbcf7b2](https://github.com/npm/hosted-git-info/commit/bbcf7b2)), closes [#46](https://github.com/npm/hosted-git-info/issues/46) [#43](https://github.com/npm/hosted-git-info/issues/43)
* **git-host:** disallow URI-encoded slash (%2F) in `path` ([3776fa5](https://github.com/npm/hosted-git-info/commit/3776fa5)), closes [#44](https://github.com/npm/hosted-git-info/issues/44)
* **gitlab:** Do not URL encode slashes in project name for GitLab https URL ([cbf04f9](https://github.com/npm/hosted-git-info/commit/cbf04f9)), closes [#47](https://github.com/npm/hosted-git-info/issues/47)
* do not allow invalid gist urls ([d5cf830](https://github.com/npm/hosted-git-info/commit/d5cf830))
* **cache:** Switch to lru-cache to save ourselves from unlimited memory consumption ([e518222](https://github.com/npm/hosted-git-info/commit/e518222)), closes [#38](https://github.com/npm/hosted-git-info/issues/38)


### Features

* give these objects a name ([60abaea](https://github.com/npm/hosted-git-info/commit/60abaea))



<a name="2.7.1"></a>
## [2.7.1](https://github.com/npm/hosted-git-info/compare/v2.7.0...v2.7.1) (2018-07-07)


### Bug Fixes

* **index:** Guard against non-string types ([5bc580d](https://github.com/npm/hosted-git-info/commit/5bc580d))
* **parse:** Crash on strings that parse to having no host ([c931482](https://github.com/npm/hosted-git-info/commit/c931482)), closes [#35](https://github.com/npm/hosted-git-info/issues/35)



<a name="2.7.0"></a>
# [2.7.0](https://github.com/npm/hosted-git-info/compare/v2.6.1...v2.7.0) (2018-07-06)


### Bug Fixes

* **github tarball:** update github tarballtemplate ([6efd582](https://github.com/npm/hosted-git-info/commit/6efd582)), closes [#34](https://github.com/npm/hosted-git-info/issues/34)
* **gitlab docs:** switched to lowercase anchors for readmes ([701bcd1](https://github.com/npm/hosted-git-info/commit/701bcd1))


### Features

* **all:** Support www. prefixes on hostnames ([3349575](https://github.com/npm/hosted-git-info/commit/3349575)), closes [#32](https://github.com/npm/hosted-git-info/issues/32)



<a name="2.6.1"></a>
## [2.6.1](https://github.com/npm/hosted-git-info/compare/v2.6.0...v2.6.1) (2018-06-25)

### Bug Fixes

* **Revert:** "compat: remove Object.assign fallback ([#25](https://github.com/npm/hosted-git-info/issues/25))" ([cce5a62](https://github.com/npm/hosted-git-info/commit/cce5a62))
* **Revert:** "git-host: fix forgotten extend()" ([a815ec9](https://github.com/npm/hosted-git-info/commit/a815ec9))



<a name="2.6.0"></a>
# [2.6.0](https://github.com/npm/hosted-git-info/compare/v2.5.0...v2.6.0) (2018-03-07)

11 changes: 6 additions & 5 deletions git-host-info.js
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ var gitHosts = module.exports = {
'filetemplate': 'https://{auth@}raw.githubusercontent.com/{user}/{project}/{committish}/{path}',
'bugstemplate': 'https://{domain}/{user}/{project}/issues',
'gittemplate': 'git://{auth@}{domain}/{user}/{project}.git{#committish}',
'tarballtemplate': 'https://{domain}/{user}/{project}/archive/{committish}.tar.gz'
'tarballtemplate': 'https://codeload.{domain}/{user}/{project}/tar.gz/{committish}'
},
bitbucket: {
'protocols': [ 'git+ssh', 'git+https', 'ssh', 'https' ],
@@ -22,14 +22,15 @@ var gitHosts = module.exports = {
'protocols': [ 'git+ssh', 'git+https', 'ssh', 'https' ],
'domain': 'gitlab.com',
'treepath': 'tree',
'docstemplate': 'https://{domain}/{user}/{project}{/tree/committish}#README',
'bugstemplate': 'https://{domain}/{user}/{project}/issues',
'tarballtemplate': 'https://{domain}/{user}/{project}/repository/archive.tar.gz?ref={committish}'
'httpstemplate': 'git+https://{auth@}{domain}/{user}/{projectPath}.git{#committish}',
'tarballtemplate': 'https://{domain}/{user}/{project}/repository/archive.tar.gz?ref={committish}',
'pathmatch': /^[/]([^/]+)[/]((?!.*(\/-\/|\/repository\/archive\.tar\.gz\?=.*|\/repository\/[^/]+\/archive.tar.gz$)).*?)(?:[.]git|[/])?$/
},
gist: {
'protocols': [ 'git', 'git+ssh', 'git+https', 'ssh', 'https' ],
'domain': 'gist.github.com',
'pathmatch': /^[/](?:([^/]+)[/])?([a-z0-9]+)(?:[.]git)?$/,
'pathmatch': /^[/](?:([^/]+)[/])?([a-z0-9]{32,})(?:[.]git)?$/,
'filetemplate': 'https://gist.githubusercontent.com/{user}/{project}/raw{/committish}/{path}',
'bugstemplate': 'https://{domain}/{project}',
'gittemplate': 'git://{domain}/{project}.git{#committish}',
@@ -41,7 +42,7 @@ var gitHosts = module.exports = {
'httpstemplate': 'git+https://{domain}/{project}.git{#committish}',
'shortcuttemplate': '{type}:{project}{#committish}',
'pathtemplate': '{project}{#committish}',
'tarballtemplate': 'https://{domain}/{user}/{project}/archive/{committish}.tar.gz',
'tarballtemplate': 'https://codeload.github.com/gist/{project}/tar.gz/{committish}',
'hashformat': function (fragment) {
return 'file-' + formatHashFragment(fragment)
}
57 changes: 42 additions & 15 deletions git-host.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
'use strict'
var gitHosts = require('./git-host-info.js')
/* eslint-disable node/no-deprecated-api */

// copy-pasta util._extend from node's source, to avoid pulling
// the whole util module into peoples' webpack bundles.
/* istanbul ignore next */
var extend = Object.assign || function _extend (target, source) {
// Don't do anything if source isn't an object
if (source === null || typeof source !== 'object') return target

var keys = Object.keys(source)
var i = keys.length
while (i--) {
target[keys[i]] = source[keys[i]]
}
return target
}

var GitHost = module.exports = function (type, user, auth, project, committish, defaultRepresentation, opts) {
module.exports = GitHost
function GitHost (type, user, auth, project, committish, defaultRepresentation, opts) {
var gitHostInfo = this
gitHostInfo.type = type
Object.keys(gitHosts[type]).forEach(function (key) {
@@ -14,43 +31,51 @@ var GitHost = module.exports = function (type, user, auth, project, committish,
gitHostInfo.default = defaultRepresentation
gitHostInfo.opts = opts || {}
}
GitHost.prototype = {}

GitHost.prototype.hash = function () {
return this.committish ? '#' + this.committish : ''
}

GitHost.prototype._fill = function (template, opts) {
if (!template) return
var vars = Object.assign({}, opts)
var vars = extend({}, opts)
vars.path = vars.path ? vars.path.replace(/^[/]+/g, '') : ''
opts = Object.assign({}, this.opts, opts)
opts = extend(extend({}, this.opts), opts)
var self = this
Object.keys(this).forEach(function (key) {
if (self[key] != null && vars[key] == null) vars[key] = self[key]
})
var rawAuth = vars.auth
var rawComittish = vars.committish
var rawcommittish = vars.committish
var rawFragment = vars.fragment
var rawPath = vars.path
var rawProject = vars.project
Object.keys(vars).forEach(function (key) {
vars[key] = encodeURIComponent(vars[key])
var value = vars[key]
if ((key === 'path' || key === 'project') && typeof value === 'string') {
vars[key] = value.split('/').map(function (pathComponent) {
return encodeURIComponent(pathComponent)
}).join('/')
} else {
vars[key] = encodeURIComponent(value)
}
})
vars['auth@'] = rawAuth ? rawAuth + '@' : ''
vars['#fragment'] = rawFragment ? '#' + this.hashformat(rawFragment) : ''
vars.fragment = vars.fragment ? vars.fragment : ''
vars['#path'] = rawPath ? '#' + this.hashformat(rawPath) : ''
vars['/path'] = vars.path ? '/' + vars.path : ''
vars.projectPath = rawProject.split('/').map(encodeURIComponent).join('/')
if (opts.noCommittish) {
vars['#committish'] = ''
vars['/tree/committish'] = ''
vars['/comittish'] = ''
vars.comittish = ''
vars['/committish'] = ''
vars.committish = ''
} else {
vars['#committish'] = rawComittish ? '#' + rawComittish : ''
vars['#committish'] = rawcommittish ? '#' + rawcommittish : ''
vars['/tree/committish'] = vars.committish
? '/' + vars.treepath + '/' + vars.committish
: ''
? '/' + vars.treepath + '/' + vars.committish
: ''
vars['/committish'] = vars.committish ? '/' + vars.committish : ''
vars.committish = vars.committish || 'master'
}
@@ -79,7 +104,7 @@ GitHost.prototype.browse = function (P, F, opts) {
opts = F
F = null
}
return this._fill(this.browsefiletemplate, Object.assign({
return this._fill(this.browsefiletemplate, extend({
fragment: F,
path: P
}, opts))
@@ -112,18 +137,20 @@ GitHost.prototype.path = function (opts) {
return this._fill(this.pathtemplate, opts)
}

GitHost.prototype.tarball = function (opts) {
GitHost.prototype.tarball = function (opts_) {
var opts = extend({}, opts_, { noCommittish: false })
return this._fill(this.tarballtemplate, opts)
}

GitHost.prototype.file = function (P, opts) {
return this._fill(this.filetemplate, Object.assign({ path: P }, opts))
return this._fill(this.filetemplate, extend({ path: P }, opts))
}

GitHost.prototype.getDefaultRepresentation = function () {
return this.default
}

GitHost.prototype.toString = function (opts) {
return (this[this.default] || this.sshurl).call(this, opts)
if (this.default && typeof this[this.default] === 'function') return this[this.default](opts)
return this.sshurl(opts)
}
Loading