🏡 index : ~doyle/rgit.git

author Jordan Doyle <jordan@doyle.la> 2022-07-24 13:10:14.0 +01:00:00
committer Jordan Doyle <jordan@doyle.la> 2022-07-24 13:11:00.0 +01:00:00
commit
e6c2ed33e8bd2329065df6465af3dd8907116c50 [patch]
tree
153a37fe31fc113e241c2513f1f06ca6dac4ea24
parent
815178015856e451808c299df23fb2ad615fb2c6
download
e6c2ed33e8bd2329065df6465af3dd8907116c50.tar.gz

Fix range for single commit repositories



Diff

 src/database/schema/commit.rs | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/database/schema/commit.rs b/src/database/schema/commit.rs
index 978e6e3..3abecb0 100644
--- a/src/database/schema/commit.rs
+++ a/src/database/schema/commit.rs
@@ -143,8 +143,12 @@

        let end = latest_key.saturating_sub(offset);
        let start = end.saturating_sub(amount);

        let iter = self.range(start.to_be_bytes()..end.to_be_bytes());
        let range = start.to_be_bytes()..end.to_be_bytes();
        let iter = if range.is_empty() {
            self.range(start.to_be_bytes()..=end.to_be_bytes())
        } else {
            self.range(range)
        };

        tokio::task::spawn_blocking(move || {
            iter.rev()