diff options
author | Teddy Wing | 2021-05-30 17:14:25 +0200 |
---|---|---|
committer | Teddy Wing | 2021-05-30 17:14:25 +0200 |
commit | f8971cea4f8f916bbb528169f06c513c2a18802e (patch) | |
tree | de07b47deee291182020dfe5e68fbc75fb9bcac3 /src/main.rs | |
parent | 7fc7462bdb6565fa4e49a9f15099f8faed5385b5 (diff) | |
download | reflectub-f8971cea4f8f916bbb528169f06c513c2a18802e.tar.bz2 |
main::update(): Update repository description on fetch update
If the repository was updated, write the description into the
`description` file.
Add a `github::Repo.description()` method to get an empty string if the
description is `None`. This facilitates writing to the `description`
file.
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index 3f2c9a7..ec94601 100644 --- a/src/main.rs +++ b/src/main.rs @@ -64,7 +64,7 @@ async fn main() { match db.repo_get(id).await { Ok(_) => { if db.repo_is_updated(&db_repo).await.unwrap() { - update(&path).unwrap(); + update(&path, &repo).unwrap(); db.repo_update(&db_repo).await.unwrap(); } @@ -108,14 +108,18 @@ fn mirror<P: AsRef<Path>>( git::mirror( &repo.git_url, &clone_path, - repo.description.as_deref(), + repo.description(), )?; Ok(()) } -fn update<P: AsRef<Path>>(repo_path: P) -> anyhow::Result<()> { - git::update(repo_path)?; +fn update<P: AsRef<Path>>( + repo_path: P, + repo: &github::Repo, +) -> anyhow::Result<()> { + git::update(&repo_path)?; + git::update_description(&repo_path, repo.description())?; Ok(()) } |