From e6c2ed33e8bd2329065df6465af3dd8907116c50 Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Sun, 24 Jul 2022 13:10:14 +0100 Subject: [PATCH] Fix range for single commit repositories --- 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() -- rgit 0.1.3