Commit e181a649dfd9af86e272605274e645b7725819c4

Edward Thomson 2018-09-18T03:03:03

Merge pull request #4809 from libgit2/cmn/revwalk-sign-regression Fix revwalk limiting regression

diff --git a/src/revwalk.c b/src/revwalk.c
index da84a44..4c5a1da 100644
--- a/src/revwalk.c
+++ b/src/revwalk.c
@@ -388,10 +388,16 @@ static int still_interesting(git_commit_list *list, int64_t time, int slop)
 	if (!list)
 		return 0;
 
+	/*
+	 * If the destination list has commits with an earlier date than our
+	 * source, we want to reset the slop counter as we're not done.
+	 */
+	if (time <= list->item->time)
+		return SLOP;
+
 	for (; list; list = list->next) {
 		/*
-		 * If the destination list has commits with an earlier date than
-		 * our source or if it still contains interesting commits we
+		 * If the destination list still contains interesting commits we
 		 * want to continue looking.
 		 */
 		if (!list->item->uninteresting || list->item->time > time)
@@ -405,7 +411,7 @@ static int still_interesting(git_commit_list *list, int64_t time, int slop)
 static int limit_list(git_commit_list **out, git_revwalk *walk, git_commit_list *commits)
 {
 	int error, slop = SLOP;
-	int64_t time = ~0ll;
+	int64_t time = INT64_MAX;
 	git_commit_list *list = commits;
 	git_commit_list *newlist = NULL;
 	git_commit_list **p = &newlist;