use std::path::PathBuf;
pub type Result<T, E = Error> = std::result::Result<T, E>;
#[derive(Debug, Error)]
pub enum Error {
#[error("io: {0}")]
Io(#[from] std::io::Error),
#[error("utf8: {0}")]
Utf8(#[from] std::string::FromUtf8Error),
#[error("parse int: {0}")]
ParseInt(#[from] std::num::ParseIntError),
#[error("not a valid hex char: {0}")]
InvalidHexByte(u8),
#[error("invalid commit header: {0}")]
InvalidCommitHeader(String),
#[error("current directory is not in a repository")]
CurrentDirectoryNotInRepository,
#[error("this path isn't a repository: {0}")]
PathIsNotRepository(PathBuf),
#[error("wrong object id length: expecting 40, got {0}")]
ObjectIdWrongLength(usize),
#[error("invalid object type: {0}")]
BadGitObjectType(String),
}