rung_git/
error.rs

1//! Error types for rung-git.
2
3/// Result type alias using [`Error`].
4pub type Result<T> = std::result::Result<T, Error>;
5
6/// Errors that can occur during git operations.
7#[derive(Debug, thiserror::Error)]
8pub enum Error {
9    /// Not inside a git repository.
10    #[error("not a git repository")]
11    NotARepository,
12
13    /// Branch not found.
14    #[error("branch not found: {0}")]
15    BranchNotFound(String),
16
17    /// Reference not found.
18    #[error("reference not found: {0}")]
19    RefNotFound(String),
20
21    /// HEAD is detached (not on a branch).
22    #[error("HEAD is detached - checkout a branch first")]
23    DetachedHead,
24
25    /// Rebase conflict.
26    #[error("rebase conflict in: {0:?}")]
27    RebaseConflict(Vec<String>),
28
29    /// Rebase failed.
30    #[error("rebase failed: {0}")]
31    RebaseFailed(String),
32
33    /// Working directory is dirty.
34    #[error("working directory has uncommitted changes")]
35    DirtyWorkingDirectory,
36
37    /// Remote not found.
38    #[error("remote not found: {0}")]
39    RemoteNotFound(String),
40
41    /// Invalid remote URL.
42    #[error("invalid remote URL: {0}")]
43    InvalidRemoteUrl(String),
44
45    /// Push failed.
46    #[error("push failed: {0}")]
47    PushFailed(String),
48
49    /// Fetch failed.
50    #[error("fetch failed: {0}")]
51    FetchFailed(String),
52
53    /// Underlying git2 error.
54    #[error("git error: {0}")]
55    Git2(#[from] git2::Error),
56}