From 0e77483c0385ffea83307ea504439c9940223fd0 Mon Sep 17 00:00:00 2001 From: Samuel BERTHE Date: Wed, 29 Jun 2016 17:04:56 +0200 Subject: [PATCH] fix(infinite-loop): Rebased commit has a different sha1 --- github/api.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/github/api.js b/github/api.js index be0eacd..5e4bfb8 100644 --- a/github/api.js +++ b/github/api.js @@ -57,6 +57,13 @@ module.exports = function(credentials, owner, repo) { } return pageStreamCallback(index + 1) + .flatMap(function (commits) { + if (commits.length == 0) { + paginationNeeded = false; + } + return commits; + }) + .flatMap(Bacon.fromArray) .doAction(function(item) { if (stopCondition(item)) { paginationNeeded = false; @@ -87,8 +94,7 @@ module.exports = function(credentials, owner, repo) { }; return Bacon - .fromNodeCallback(github.pullRequests.getAll, requestParams) - .flatMap(Bacon.fromArray); + .fromNodeCallback(github.pullRequests.getAll, requestParams); } function stopWhenSinceIsReached(pullRequest) { @@ -123,8 +129,7 @@ module.exports = function(credentials, owner, repo) { } return Bacon - .fromNodeCallback(github.repos.getCommits, requestParams) - .flatMap(Bacon.fromArray); + .fromNodeCallback(github.repos.getCommits, requestParams); } var stopWhenSinceIsReached;