#![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)]
#![allow(clippy::result_large_err)]
pub use gix_actor as actor;
#[cfg(feature = "attributes")]
pub use gix_attributes as attrs;
pub use gix_commitgraph as commitgraph;
#[cfg(feature = "credentials")]
pub use gix_credentials as credentials;
pub use gix_date as date;
pub use gix_features as features;
use gix_features::threading::OwnShared;
pub use gix_features::{
parallel,
progress::{Count, NestedProgress, Progress},
threading,
};
pub use gix_fs as fs;
pub use gix_glob as glob;
pub use gix_hash as hash;
pub use gix_hashtable as hashtable;
#[cfg(feature = "excludes")]
pub use gix_ignore as ignore;
#[doc(inline)]
#[cfg(feature = "index")]
pub use gix_index as index;
pub use gix_lock as lock;
#[cfg(feature = "credentials")]
pub use gix_negotiate as negotiate;
pub use gix_object as objs;
pub use gix_object::bstr;
pub use gix_odb as odb;
#[cfg(feature = "credentials")]
pub use gix_prompt as prompt;
#[cfg(feature = "gix-protocol")]
pub use gix_protocol as protocol;
pub use gix_ref as refs;
pub use gix_refspec as refspec;
pub use gix_revwalk as revwalk;
pub use gix_sec as sec;
pub use gix_tempfile as tempfile;
pub use gix_trace as trace;
pub use gix_traverse as traverse;
pub use gix_url as url;
#[doc(inline)]
pub use gix_url::Url;
pub use gix_utils as utils;
pub use hash::{oid, ObjectId};
#[cfg(feature = "interrupt")]
pub mod interrupt;
mod ext;
pub mod prelude;
#[cfg(feature = "excludes")]
mod attribute_stack;
pub mod path;
pub type RefStore = gix_ref::file::Store;
pub type OdbHandle = gix_odb::Handle;
pub(crate) type Config = OwnShared<gix_config::File<'static>>;
mod types;
#[cfg(any(feature = "excludes", feature = "attributes"))]
pub use types::AttributeStack;
pub use types::{
Commit, Head, Id, Object, ObjectDetached, Reference, Remote, Repository, Tag, ThreadSafeRepository, Tree, Worktree,
};
#[cfg(feature = "attributes")]
pub use types::{Pathspec, Submodule};
pub mod clone;
pub mod commit;
pub mod head;
pub mod id;
pub mod object;
#[cfg(feature = "attributes")]
pub mod pathspec;
pub mod reference;
pub mod repository;
#[cfg(feature = "attributes")]
pub mod submodule;
pub mod tag;
pub mod progress;
pub mod diff;
#[allow(clippy::result_large_err)]
pub fn discover(directory: impl AsRef<std::path::Path>) -> Result<Repository, discover::Error> {
ThreadSafeRepository::discover(directory).map(Into::into)
}
#[allow(clippy::result_large_err)]
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)
}
#[allow(clippy::result_large_err)]
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<gix_url::Url, Error = E>,
gix_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<gix_url::Url, Error = E>,
gix_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 gix_sec::trust::DefaultForLevel;
let mut opts = open::Options::default_for_level(gix_sec::Trust::Full);
opts.permissions.config.git_binary = true;
opts
}
#[allow(clippy::result_large_err)]
#[doc(alias = "git2")]
pub fn open(directory: impl Into<std::path::PathBuf>) -> Result<Repository, open::Error> {
ThreadSafeRepository::open(directory).map(Into::into)
}
#[allow(clippy::result_large_err)]
#[doc(alias = "open_ext", alias = "git2")]
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 create;
pub mod open;
pub mod config;
#[cfg(feature = "mailmap")]
pub mod mailmap;
pub mod worktree;
pub mod revision;
#[cfg(feature = "attributes")]
pub mod filter;
pub mod remote;
pub mod init;
pub mod state;
pub mod shallow;
pub mod discover;
pub mod env;