cargo fmt
Diff
src/git.rs | 4 +++-
src/database/indexer.rs | 10 ++++++++++
src/database/schema/commit.rs | 17 ++++++++++-------
3 files changed, 18 insertions(+), 13 deletions(-)
@@ -211,7 +211,9 @@
}
}
built_refs.branch.sort_unstable_by(|one, two| one.commit.committer.time.cmp(&two.commit.committer.time));
built_refs.branch.sort_unstable_by(|one, two| {
one.commit.committer.time.cmp(&two.commit.committer.time)
});
built_refs.tag.sort_unstable_by(|one, two| {
let one_tagger = one.tagger.as_ref().map(|v| v.time);
let two_tagger = two.tagger.as_ref().map(|v| v.time);
@@ -51,14 +51,20 @@
continue;
}
let span = info_span!("index_update", reference = reference_name.as_ref(), repository = relative_path);
let span = info_span!(
"index_update",
reference = reference_name.as_ref(),
repository = relative_path
);
let _entered = span.enter();
info!("Refreshing indexes");
let commit_tree = db_repository.get().commit_tree(db, &reference_name);
if let (Some(latest_indexed), Ok(latest_commit)) = (commit_tree.fetch_latest_one(), reference.peel_to_commit()) {
if let (Some(latest_indexed), Ok(latest_commit)) =
(commit_tree.fetch_latest_one(), reference.peel_to_commit())
{
if latest_commit.id().as_bytes() == &*latest_indexed.get().hash {
info!("No commits since last index");
continue;
@@ -121,17 +121,14 @@
}
pub fn fetch_latest_one(&self) -> Option<YokedCommit> {
self.last()
.unwrap()
.map(|(_, value)| {
let value = Box::new(value);
self.last().unwrap().map(|(_, value)| {
let value = Box::new(value);
Yoke::try_attach_to_cart(value, |data: &IVec| bincode::deserialize(&data))
.unwrap()
})
Yoke::try_attach_to_cart(value, |data: &IVec| bincode::deserialize(&data)).unwrap()
})
}
pub async fn fetch_latest(&self, amount: usize, offset: usize) -> Vec<YokedCommit> {