#![cfg_attr(
feature = "document-features",
cfg_attr(doc, doc = ::document_features::document_features!())
)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![deny(missing_docs, rust_2018_idioms, unsafe_code)]
pub use git_actor as actor;
pub use git_attributes as attrs;
pub use git_credentials as credentials;
pub use git_date as date;
pub use git_diff as diff;
pub use git_features as features;
use git_features::threading::OwnShared;
pub use git_features::{parallel, progress::Progress, threading};
pub use git_glob as glob;
pub use git_hash as hash;
#[doc(inline)]
pub use git_index as index;
pub use git_lock as lock;
pub use git_object as objs;
pub use git_object::bstr;
pub use git_odb as odb;
pub use git_prompt as prompt;
#[cfg(all(feature = "git-protocol"))]
pub use git_protocol as protocol;
pub use git_ref as refs;
pub use git_refspec as refspec;
pub use git_sec as sec;
pub use git_tempfile as tempfile;
pub use git_traverse as traverse;
pub use git_url as url;
#[doc(inline)]
pub use git_url::Url;
pub use hash::{oid, ObjectId};
pub mod interrupt;
mod ext;
pub mod prelude {
pub use git_features::parallel::reduce::Finalize;
pub use git_odb::{Find, FindExt, Header, HeaderExt, Write};
pub use crate::ext::*;
}
pub mod path;
pub type RefStore = git_ref::file::Store;
pub type OdbHandle = git_odb::Handle;
pub(crate) type Config = OwnShared<git_config::File<'static>>;
mod types;
pub use types::{
Commit, Head, Id, Kind, Object, ObjectDetached, Reference, Remote, Repository, Tag, ThreadSafeRepository, Tree,
Worktree,
};
pub mod clone;
pub mod commit;
pub mod head;
pub mod id;
pub mod object;
pub mod reference;
mod repository;
pub mod tag;
pub mod progress {
pub use git_features::progress::*;
pub use prodash::tree;
}
pub fn discover(directory: impl AsRef<std::path::Path>) -> Result<Repository, discover::Error> {
ThreadSafeRepository::discover(directory).map(Into::into)
}
pub fn init(directory: impl AsRef<std::path::Path>) -> Result<Repository, init::Error> {
ThreadSafeRepository::init(directory, create::Kind::WithWorktree, create::Options::default()).map(Into::into)
}
pub fn init_bare(directory: impl AsRef<std::path::Path>) -> Result<Repository, init::Error> {
ThreadSafeRepository::init(directory, create::Kind::Bare, create::Options::default()).map(Into::into)
}
#[allow(clippy::result_large_err)]
pub fn prepare_clone_bare<Url, E>(
url: Url,
path: impl AsRef<std::path::Path>,
) -> Result<clone::PrepareFetch, clone::Error>
where
Url: std::convert::TryInto<git_url::Url, Error = E>,
git_url::parse::Error: From<E>,
{
clone::PrepareFetch::new(
url,
path,
create::Kind::Bare,
create::Options::default(),
open_opts_with_git_binary_config(),
)
}
#[allow(clippy::result_large_err)]
pub fn prepare_clone<Url, E>(url: Url, path: impl AsRef<std::path::Path>) -> Result<clone::PrepareFetch, clone::Error>
where
Url: std::convert::TryInto<git_url::Url, Error = E>,
git_url::parse::Error: From<E>,
{
clone::PrepareFetch::new(
url,
path,
create::Kind::WithWorktree,
create::Options::default(),
open_opts_with_git_binary_config(),
)
}
fn open_opts_with_git_binary_config() -> open::Options {
use git_sec::trust::DefaultForLevel;
let mut opts = open::Options::default_for_level(git_sec::Trust::Full);
opts.permissions.config.git_binary = true;
opts
}
pub fn open(directory: impl Into<std::path::PathBuf>) -> Result<Repository, open::Error> {
ThreadSafeRepository::open(directory).map(Into::into)
}
pub fn open_opts(directory: impl Into<std::path::PathBuf>, options: open::Options) -> Result<Repository, open::Error> {
ThreadSafeRepository::open_opts(directory, options).map(Into::into)
}
pub mod permission {
pub mod env_var {
pub mod resource {
pub type Error = git_sec::permission::Error<std::path::PathBuf>;
}
}
}
pub mod permissions {
pub use crate::repository::permissions::{Config, Environment};
}
pub use repository::permissions::Permissions;
pub mod create;
pub mod open;
pub mod config;
pub mod mailmap;
pub mod worktree;
pub mod revision;
pub mod remote;
pub mod init;
pub mod state {
#[derive(Debug, PartialEq, Eq)]
pub enum InProgress {
ApplyMailbox,
ApplyMailboxRebase,
Bisect,
CherryPick,
CherryPickSequence,
Merge,
Rebase,
RebaseInteractive,
Revert,
RevertSequence,
}
}
pub mod discover;
pub mod env;
mod kind;