Skip to content

Commit 64c34b9

Browse files
authored
Merge pull request #559 from WJXHenry/issue-508
Repository 'listCommits' working when options omitted
2 parents 935783f + f2cfa93 commit 64c34b9

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lib/Repository.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,10 @@ class Repository extends Requestable {
188188
*/
189189
listCommits(options, cb) {
190190
options = options || {};
191-
191+
if (typeof options === 'function') {
192+
cb = options;
193+
options = {};
194+
}
192195
options.since = this._dateToISO(options.since);
193196
options.until = this._dateToISO(options.until);
194197

test/repository.spec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,18 @@ describe('Repository', function() {
125125
});
126126

127127
it('should list commits with no options', function(done) {
128+
remoteRepo.listCommits(assertSuccessful(done, function(err, commits) {
129+
expect(commits).to.be.an.array();
130+
expect(commits.length).to.be.above(0);
131+
132+
expect(commits[0]).to.have.own('commit');
133+
expect(commits[0]).to.have.own('author');
134+
135+
done();
136+
}));
137+
});
138+
139+
it('should list commits with null options', function(done) {
128140
remoteRepo.listCommits(null, assertSuccessful(done, function(err, commits) {
129141
expect(commits).to.be.an.array();
130142
expect(commits.length).to.be.above(0);

0 commit comments

Comments
 (0)