Skip to content

Commit 46f3512

Browse files
committed
revwalk: use the max value for a signed integer
When porting, we overlooked that the difference between git's and our's time representation and copied their way of getting the max value. Unfortunately git was using unsigned integers, so `~0ll` does correspond to their max value, whereas for us it corresponds to `-1`. This means that we always consider the last date to be smaller than the current commit's and always think commits are interesting. Change the initial value to the macro that gives us the maximum value on each platform so we can accurately consider commits interesting or not.
1 parent bc34cb6 commit 46f3512

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/revwalk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ static int still_interesting(git_commit_list *list, int64_t time, int slop)
405405
static int limit_list(git_commit_list **out, git_revwalk *walk, git_commit_list *commits)
406406
{
407407
int error, slop = SLOP;
408-
int64_t time = ~0ll;
408+
int64_t time = INT64_MAX;
409409
git_commit_list *list = commits;
410410
git_commit_list *newlist = NULL;
411411
git_commit_list **p = &newlist;

0 commit comments

Comments
 (0)