1
0
mirror of https://github.com/danog/gift.git synced 2024-11-30 04:19:37 +01:00

Added capability to get all commits or do not limit them by giving -1 as limit

This commit is contained in:
Igor Muzyka 2014-02-19 14:10:58 +02:00
parent d6bc3d0bdf
commit 77f0b3020b

View File

@ -73,6 +73,9 @@ module.exports = class Repo
# #
# # Skip some (for pagination): # # Skip some (for pagination):
# repo.commits "master", 30, 30, (err, commits) -> # repo.commits "master", 30, 30, (err, commits) ->
#
# # Do not limit commits amount
# repo.commits "master", -1, (err, commits) ->
# #
commits: (start, limit, skip, callback) -> commits: (start, limit, skip, callback) ->
[skip, callback] = [callback, skip] if !callback [skip, callback] = [callback, skip] if !callback
@ -82,8 +85,12 @@ module.exports = class Repo
start ?= "master" start ?= "master"
limit ?= 10 limit ?= 10
skip ?= 0 skip ?= 0
options = {skip}
Commit.find_all this, start, {"max-count": limit, skip}, callback if limit != -1
options["max-count"] = limit
Commit.find_all this, start, options, callback
# Internal: Returns current commit id # Internal: Returns current commit id