diff options
author | Carlos MartÃn Nieto <cmn@dwim.me> | 2018-09-17 14:49:46 +0200 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2018-10-26 14:58:51 +0200 |
commit | b69089fd2aefecb028be2a067b4dda5fa906c0b6 (patch) | |
tree | 836eb0e11a8d41e2f1a9485c0f33d37efde0af22 | |
parent | 3cabf8d15e00d7d71aa4df01af07d0dbc974afe9 (diff) | |
download | libgit2-b69089fd2aefecb028be2a067b4dda5fa906c0b6.tar.gz |
revwalk: only check the first commit in the list for an earlier timestamp
This is not a big deal, but it does make us match git more closely by checking
only the first. The lists are sorted already, so there should be no functional
difference other than removing a possible check from every iteration in the
loop.
(cherry picked from commit 12a1790d8e71087056d2b2de936ddae439e1d94c)
-rw-r--r-- | src/revwalk.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/revwalk.c b/src/revwalk.c index 7f50e9cd8..f11dc0630 100644 --- a/src/revwalk.c +++ b/src/revwalk.c @@ -384,10 +384,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) |