🏡 index : ~doyle/rgit.git

author Jordan Doyle <jordan@doyle.la> 2022-07-16 12:00:00.0 +01:00:00
committer Jordan Doyle <jordan@doyle.la> 2022-07-16 12:00:00.0 +01:00:00
commit
9db6315eb4ed3bea716eda6f1e7b91cd519c71dc [patch]
tree
c8bab33e9629ab043e7c659b8439ed265c083079
parent
d66a989bd62ca656c30bcb3a3e7a90bacdaa460a
download
9db6315eb4ed3bea716eda6f1e7b91cd519c71dc.tar.gz

Fix offset calculation to return None when no more commits exist



Diff

 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)
        })