Skip to content

Commit 5d4a8d7

Browse files
committed
fix: ignore noCommittish on tarball url generation
Omitting the committish breaks every host's tarball serving capabilities. Just override that setting.
1 parent 1692435 commit 5d4a8d7

File tree

5 files changed

+6
-1
lines changed

5 files changed

+6
-1
lines changed

git-host.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ GitHost.prototype.path = function (opts) {
137137
return this._fill(this.pathtemplate, opts)
138138
}
139139

140-
GitHost.prototype.tarball = function (opts) {
140+
GitHost.prototype.tarball = function (opts_) {
141+
var opts = extend({}, opts_, { noCommittish: false })
141142
return this._fill(this.tarballtemplate, opts)
142143
}
143144

test/bitbucket.js

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ test('fromUrl(bitbucket url)', function (t) {
2323
t.is(hostinfo.file('C'), 'https://bitbucket.org/111/222/raw/' + (branch || 'master') + '/C', label + ' -> file')
2424
t.is(hostinfo.file('C/D'), 'https://bitbucket.org/111/222/raw/' + (branch || 'master') + '/C/D', label + ' -> file')
2525
t.is(hostinfo.tarball(), 'https://bitbucket.org/111/222/get/' + (branch || 'master') + '.tar.gz', label + ' -> tarball')
26+
t.is(hostinfo.tarball({ noCommittish: true }), 'https://bitbucket.org/111/222/get/' + (branch || 'master') + '.tar.gz', label + ' -> tarball')
2627
}
2728

2829
require('./lib/standard-tests')(verify, 'bitbucket.org', 'bitbucket')

test/gist.js

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ test('fromUrl(gist url)', function (t) {
2626
t.is(hostinfo.file('C'), 'https://gist.githubusercontent.com/111/' + proj + '/raw/' + (branch ? branch + '/' : '') + 'C', label + ' -> file')
2727
t.is(hostinfo.file('C/D'), 'https://gist.githubusercontent.com/111/' + proj + '/raw/' + (branch ? branch + '/' : '') + 'C/D', label + ' -> file')
2828
t.is(hostinfo.tarball(), 'https://codeload.github.com/gist/' + proj + '/tar.gz/' + (branch || 'master'), label + ' -> tarball')
29+
t.is(hostinfo.tarball({ noCommittish: true }), 'https://codeload.github.com/gist/' + proj + '/tar.gz/' + (branch || 'master'), label + ' -> tarball')
2930
}
3031
}
3132

test/github.js

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ test('fromUrl(github url)', function (t) {
3131
t.is(hostinfo.file('C'), 'https://raw.githubusercontent.com/111/222/' + (branch || 'master') + '/C', label + ' -> file')
3232
t.is(hostinfo.file('C/D'), 'https://raw.githubusercontent.com/111/222/' + (branch || 'master') + '/C/D', label + ' -> file')
3333
t.is(hostinfo.tarball(), 'https://codeload.github.com/111/222/tar.gz/' + (branch || 'master'), label + ' -> tarball')
34+
t.is(hostinfo.tarball({ noCommittish: true }), 'https://codeload.github.com/111/222/tar.gz/' + (branch || 'master'), label + ' -> tarball')
3435
}
3536

3637
// github shorturls

test/gitlab.js

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ test('fromUrl(gitlab url)', function (t) {
2323
t.is(hostinfo.file('C'), 'https://gitlab.com/111/222/raw/' + (branch || 'master') + '/C', label + ' -> file')
2424
t.is(hostinfo.file('C/D'), 'https://gitlab.com/111/222/raw/' + (branch || 'master') + '/C/D', label + ' -> file')
2525
t.is(hostinfo.tarball(), 'https://gitlab.com/111/222/repository/archive.tar.gz?ref=' + (branch || 'master'), label + ' -> tarball')
26+
t.is(hostinfo.tarball({ noCommittish: true }), 'https://gitlab.com/111/222/repository/archive.tar.gz?ref=' + (branch || 'master'), label + ' -> tarball')
2627
}
2728

2829
require('./lib/standard-tests')(verify, 'gitlab.com', 'gitlab')

0 commit comments

Comments
 (0)