Make most links typesafe

This commit is contained in:
Joscha 2023-08-13 20:24:37 +02:00
parent 30ddf1e9b2
commit e64ea7ac12
10 changed files with 82 additions and 100 deletions

View file

@ -5,11 +5,15 @@ use sqlx::SqlitePool;
use crate::{config::Config, somehow};
use super::{link::CommitLink, paths::PathIndex, Base, Tab};
use super::{
base::{Base, Tab},
link::LinkCommit,
paths::PathIndex,
};
struct Ref {
name: String,
commit: CommitLink,
commit: LinkCommit,
tracked: bool,
}
@ -39,7 +43,7 @@ pub async fn get_index(
.fetch(&db)
.map_ok(|r| Ref {
name: r.name.clone(),
commit: CommitLink::new(&base, r.hash, &r.message, r.reachable),
commit: LinkCommit::new(&base, r.hash, &r.message, r.reachable),
tracked: r.tracked != 0,
})
.try_collect::<Vec<_>>()