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:
parent
d6bc3d0bdf
commit
77f0b3020b
@ -74,6 +74,9 @@ module.exports = class Repo
|
||||
# # Skip some (for pagination):
|
||||
# repo.commits "master", 30, 30, (err, commits) ->
|
||||
#
|
||||
# # Do not limit commits amount
|
||||
# repo.commits "master", -1, (err, commits) ->
|
||||
#
|
||||
commits: (start, limit, skip, callback) ->
|
||||
[skip, callback] = [callback, skip] if !callback
|
||||
[limit, callback] = [callback, limit] if !callback
|
||||
@ -82,8 +85,12 @@ module.exports = class Repo
|
||||
start ?= "master"
|
||||
limit ?= 10
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user