update semantics slightly

This commit is contained in:
slonkazoid 2024-12-14 01:41:11 +03:00
parent 3c4db952ec
commit e63159b5e3
Signed by: slonk
SSH key fingerprint: SHA256:tbZfJX4IOvZ0LGWOWu5Ijo8jfMPi78TU7x1VoEeCIjM

View file

@ -10,9 +10,9 @@ use crate::config::RepoConfig;
#[tracing::instrument]
pub async fn update_repo(repo: &RepoConfig) -> Result<ExitStatus> {
match std::fs::metadata(&repo.path) {
match std::fs::metadata(repo.path.join(".git")) {
Ok(metadata) if metadata.is_dir() => {
info!("directory exists, pulling");
info!("repository exists, pulling");
Command::new("git")
.current_dir(&repo.path)
.arg("pull")
@ -24,7 +24,7 @@ pub async fn update_repo(repo: &RepoConfig) -> Result<ExitStatus> {
}
Ok(_) => Err(std::io::ErrorKind::NotADirectory.into()),
Err(error) if error.kind() == std::io::ErrorKind::NotFound => {
info!("not found, cloning");
info!("not a repository, cloning");
Command::new("git")
.arg("clone")
.arg(&repo.url)