Files
yaak/src-tauri/yaak-git/src/repository.rs
Gregory Schier cfbfd66eef Reformat project
2025-12-13 08:10:12 -08:00

11 lines
372 B
Rust

use crate::error::Error::{GitRepoNotFound, GitUnknown};
use std::path::Path;
pub(crate) fn open_repo(dir: &Path) -> crate::error::Result<git2::Repository> {
match git2::Repository::discover(dir) {
Ok(r) => Ok(r),
Err(e) if e.code() == git2::ErrorCode::NotFound => Err(GitRepoNotFound(dir.to_path_buf())),
Err(e) => Err(GitUnknown(e)),
}
}