1use std::path::PathBuf;
2
3#[derive(thiserror::Error, Debug)]
6pub enum GitError {
7 #[error("git is not installed or not in PATH")]
8 NotInstalled,
9
10 #[error("git version {found} is below minimum required {required}")]
11 VersionTooOld { found: String, required: String },
12
13 #[error("not a git repository: {}", path.display())]
14 NotARepo { path: PathBuf },
15
16 #[error("branch '{branch}' is already checked out at another worktree")]
17 BranchConflict { branch: String },
18
19 #[error("repository has uncommitted changes")]
20 DirtyWorktree,
21
22 #[error("git command failed: {command}\n{stderr}")]
23 CommandFailed { command: String, stderr: String },
24
25 #[error(transparent)]
26 Io(#[from] std::io::Error),
27}