diff --git a/git-host.js b/git-host.js index 7fe8b44..0102727 100644 --- a/git-host.js +++ b/git-host.js @@ -137,7 +137,8 @@ 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) } diff --git a/test/bitbucket.js b/test/bitbucket.js index fe6297f..f79d1c3 100644 --- a/test/bitbucket.js +++ b/test/bitbucket.js @@ -23,6 +23,7 @@ test('fromUrl(bitbucket url)', function (t) { t.is(hostinfo.file('C'), 'https://bitbucket.org/111/222/raw/' + (branch || 'master') + '/C', label + ' -> file') t.is(hostinfo.file('C/D'), 'https://bitbucket.org/111/222/raw/' + (branch || 'master') + '/C/D', label + ' -> file') t.is(hostinfo.tarball(), 'https://bitbucket.org/111/222/get/' + (branch || 'master') + '.tar.gz', label + ' -> tarball') + t.is(hostinfo.tarball({ noCommittish: true }), 'https://bitbucket.org/111/222/get/' + (branch || 'master') + '.tar.gz', label + ' -> tarball') } require('./lib/standard-tests')(verify, 'bitbucket.org', 'bitbucket') diff --git a/test/gist.js b/test/gist.js index 468483d..a3bceed 100644 --- a/test/gist.js +++ b/test/gist.js @@ -26,6 +26,7 @@ test('fromUrl(gist url)', function (t) { t.is(hostinfo.file('C'), 'https://gist.githubusercontent.com/111/' + proj + '/raw/' + (branch ? branch + '/' : '') + 'C', label + ' -> file') t.is(hostinfo.file('C/D'), 'https://gist.githubusercontent.com/111/' + proj + '/raw/' + (branch ? branch + '/' : '') + 'C/D', label + ' -> file') t.is(hostinfo.tarball(), 'https://codeload.github.com/gist/' + proj + '/tar.gz/' + (branch || 'master'), label + ' -> tarball') + t.is(hostinfo.tarball({ noCommittish: true }), 'https://codeload.github.com/gist/' + proj + '/tar.gz/' + (branch || 'master'), label + ' -> tarball') } } diff --git a/test/github.js b/test/github.js index 755f1fe..74ecaa6 100644 --- a/test/github.js +++ b/test/github.js @@ -31,6 +31,7 @@ test('fromUrl(github url)', function (t) { t.is(hostinfo.file('C'), 'https://raw.githubusercontent.com/111/222/' + (branch || 'master') + '/C', label + ' -> file') t.is(hostinfo.file('C/D'), 'https://raw.githubusercontent.com/111/222/' + (branch || 'master') + '/C/D', label + ' -> file') t.is(hostinfo.tarball(), 'https://codeload.github.com/111/222/tar.gz/' + (branch || 'master'), label + ' -> tarball') + t.is(hostinfo.tarball({ noCommittish: true }), 'https://codeload.github.com/111/222/tar.gz/' + (branch || 'master'), label + ' -> tarball') } // github shorturls diff --git a/test/gitlab.js b/test/gitlab.js index dd72a11..22b13d0 100644 --- a/test/gitlab.js +++ b/test/gitlab.js @@ -23,6 +23,7 @@ test('fromUrl(gitlab url)', function (t) { t.is(hostinfo.file('C'), 'https://gitlab.com/111/222/raw/' + (branch || 'master') + '/C', label + ' -> file') t.is(hostinfo.file('C/D'), 'https://gitlab.com/111/222/raw/' + (branch || 'master') + '/C/D', label + ' -> file') t.is(hostinfo.tarball(), 'https://gitlab.com/111/222/repository/archive.tar.gz?ref=' + (branch || 'master'), label + ' -> tarball') + t.is(hostinfo.tarball({ noCommittish: true }), 'https://gitlab.com/111/222/repository/archive.tar.gz?ref=' + (branch || 'master'), label + ' -> tarball') } require('./lib/standard-tests')(verify, 'gitlab.com', 'gitlab')