forked from kemitix/git-next
37 lines
877 B
Rust
37 lines
877 B
Rust
//
|
|
use crate as git;
|
|
use git_next_config as config;
|
|
|
|
pub type Result<T> = core::result::Result<T, Error>;
|
|
|
|
#[derive(Debug, thiserror::Error)]
|
|
pub enum Error {
|
|
#[error("network: {0}")]
|
|
Network(#[from] kxio::network::NetworkError),
|
|
|
|
#[error("fetch: {0}")]
|
|
Fetch(#[from] git::fetch::Error),
|
|
|
|
#[error("push: {0}")]
|
|
Push(#[from] git::push::Error),
|
|
|
|
#[error("lock")]
|
|
Lock,
|
|
|
|
#[error("gix iter: {0}")]
|
|
GixIter(#[from] gix::reference::iter::Error),
|
|
|
|
#[error("gix iter init: {0}")]
|
|
GixIterInit(#[from] gix::reference::iter::init::Error),
|
|
}
|
|
|
|
pub fn reset(
|
|
repository: &git::OpenRepository,
|
|
repo_details: &git::RepoDetails,
|
|
branch_name: config::BranchName,
|
|
to_commit: git::GitRef,
|
|
force: git::push::Force,
|
|
) -> Result<()> {
|
|
repository.fetch()?;
|
|
Ok(repository.push(repo_details, branch_name, to_commit, force)?)
|
|
}
|