(path: PathBuf)
| 42 | } |
| 43 | |
| 44 | pub fn open(path: PathBuf) -> Result<Self> { |
| 45 | match git2::Repository::open(&path) { |
| 46 | Ok(repo) => Ok(Repo { inner: repo, path }), |
| 47 | Err(err) => match err.code() { |
| 48 | git2::ErrorCode::NotFound => Self::init(&path), |
| 49 | _ => Err(Error::Repo(format!("unable to open repo: {path:?}"))), |
| 50 | }, |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | pub fn delete(root: &DataRoot, repo_id: RepoId) -> Result<()> { |
| 55 | let path = root.repo_path(repo_id); |