use std::path::PathBuf;
#[non_exhaustive]
#[derive(Debug, thiserror::Error)]
pub enum WorktreeError {
#[error("not inside a git repository")]
NotAGitRepo,
#[error("git command `{op}` failed")]
GitCommand {
op: String,
stderr: String,
},
#[error("worktree path already exists: {0}")]
PathExists(PathBuf),
#[error("cannot resolve default branch: attempted {attempted}")]
BaseRefUnresolved {
attempted: String,
},
#[error("invalid branch name component: {0}")]
InvalidBranchName(String),
#[error("worktree root resolves outside the repository: {0}")]
RootOutsideRepo(PathBuf),
#[error(transparent)]
Io(#[from] std::io::Error),
#[error(
"worktree limit reached ({current}/{max}); run `zeph worktree clean` or raise \
`worktree.max_worktrees`"
)]
QuotaExceeded {
current: usize,
max: usize,
},
}