aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorTeddy Wing2021-06-05 14:19:34 +0200
committerTeddy Wing2021-06-05 14:19:34 +0200
commit52cf0f1b91e76d32c0f121d49cf8d4a9836d48b9 (patch)
tree3c89c0e4fd45fd47a4c004db1dcaf8b9b2895606 /src/main.rs
parentb19bc8197f5d7173dc64128565ff504f6e6f4821 (diff)
downloadreflectub-52cf0f1b91e76d32c0f121d49cf8d4a9836d48b9.tar.bz2
run(): Move comment
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs
index e487ec4..c736603 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -94,19 +94,14 @@ async fn run() -> anyhow::Result<()> {
db.create().await?;
- // If repo !exists
- // insert
- // mirror
- // Else
- // Update updated_at
- // fetch
-
for repo in test_repos {
let id = repo.id;
let path = clone_path(&mirror_root, &repo);
let db_repo = database::Repo::from(&repo);
match db.repo_get(id).await {
+ // If we've already seen the repo and it's been updated, fetch the
+ // latest.
Ok(current_repo) => {
if db.repo_is_updated(&db_repo).await? {
update(&path, &current_repo, &repo)?;
@@ -115,6 +110,8 @@ async fn run() -> anyhow::Result<()> {
}
},
+ // If the repo doesn't exist, mirror it and store it in the
+ // database.
Err(database::Error::Db(sqlx::Error::RowNotFound)) => {
mirror(
&path,