From 9db6315eb4ed3bea716eda6f1e7b91cd519c71dc Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Sat, 16 Jul 2022 12:00:00 +0100 Subject: [PATCH] Fix offset calculation to return None when no more commits exist --- src/git.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/git.rs b/src/git.rs index d178954..38aa78b 100644 --- a/src/git.rs +++ a/src/git.rs @@ -365,7 +365,12 @@ .collect(); // TODO: avoid having to take + 1 and popping the last commit off - let next_offset = commits.pop().is_some().then(|| offset + commits.len()); + let next_offset = if commits.len() > LIMIT { + commits.truncate(LIMIT); + Some(offset + LIMIT) + } else { + None + }; (commits, next_offset) }) -- rgit 0.1.3