diff options
Diffstat (limited to 'vendor/gix/src/lib.rs')
-rw-r--r-- | vendor/gix/src/lib.rs | 73 |
1 files changed, 61 insertions, 12 deletions
diff --git a/vendor/gix/src/lib.rs b/vendor/gix/src/lib.rs index 5de702dbf..672d5c91c 100644 --- a/vendor/gix/src/lib.rs +++ b/vendor/gix/src/lib.rs @@ -4,7 +4,18 @@ //! individually. Sometimes it may hide complexity under the assumption that the performance difference doesn't matter //! for all but the fewest tools out there, which would be using the underlying crates directly or file an issue. //! -//! # The prelude and extensions +//! ### The Trust Model +//! +//! It is very simple - based on the ownership of the repository compared to the user of the current process [Trust](sec::Trust) +//! is assigned. This can be [overridden](open::Options::with()) as well. Further, git configuration files track their trust level +//! per section based on and sensitive values like paths to executables or certain values will be skipped if they are from a source +//! that isn't [fully](sec::Trust::Full) trusted. +//! +//! That way, data can safely be obtained without risking to execute untrusted executables. +//! +//! Note that it's possible to let `gix` act like `git` or `git2` by setting the [open::Options::bail_if_untrusted()] option. +//! +//! ### The prelude and extensions //! //! With `use git_repository::prelude::*` you should be ready to go as it pulls in various extension traits to make functionality //! available on objects that may use it. @@ -14,13 +25,13 @@ //! Most extensions to existing objects provide an `obj_with_extension.attach(&repo).an_easier_version_of_a_method()` for simpler //! call signatures. //! -//! ## `ThreadSafe` Mode +//! ### `ThreadSafe` Mode //! //! By default, the [`Repository`] isn't `Sync` and thus can't be used in certain contexts which require the `Sync` trait. //! //! To help with this, convert it with [`.into_sync()`][Repository::into_sync()] into a [`ThreadSafeRepository`]. //! -//! ## Object-Access Performance +//! ### Object-Access Performance //! //! Accessing objects quickly is the bread-and-butter of working with git, right after accessing references. Hence it's vital //! to understand which cache levels exist and how to leverage them. @@ -42,9 +53,9 @@ //! When reading the documentation of the canonical gix-worktree program one gets the impression work tree and working tree are used //! interchangeably. We use the term _work tree_ only and try to do so consistently as its shorter and assumed to be the same. //! -//! # Cargo-features +//! ### Plumbing Crates //! -//! To make using _sub-crates_ easier these are re-exported into the root of this crate. Here we list how to access nested plumbing +//! To make using _sub-crates_ and their types easier, these are re-exported into the root of this crate. Here we list how to access nested plumbing //! crates which are otherwise harder to discover: //! //! **`git_repository::`** @@ -54,44 +65,69 @@ //! * [`transport`][protocol::transport] //! * [`packetline`][protocol::transport::packetline] //! +//! ### `libgit2` API to `gix` +//! +//! This doc-aliases are used to help finding methods under a possibly changed name. Just search in the docs. +//! Entering `git2` into the search field will also surface all methods with such annotations. +//! +//! What follows is a list of methods you might be missing, along with workarounds if available. +//! * [`git2::Repository::open_bare()`](https://docs.rs/git2/*/git2/struct.Repository.html#method.open_bare) ➡ ❌ - use [`open()`] and discard if it is not bare. +//! * [`git2::build::CheckoutBuilder::disable_filters()](https://docs.rs/git2/*/git2/build/struct.CheckoutBuilder.html#method.disable_filters) ➡ ❌ *(filters are always applied during checkouts)* +//! * [`git2::Repository::submodule_status()`](https://docs.rs/git2/*/git2/struct.Repository.html#method.submodule_status) ➡ [`Submodule::state()`] - status provides more information and conveniences though, and an actual worktree status isn't performed. //! -//! ## Feature Flags +//! ### Feature Flags #![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)] // Re-exports to make this a potential one-stop shop crate avoiding people from having to reference various crates themselves. // This also means that their major version changes affect our major version, but that's alright as we directly expose their // APIs/instances anyway. 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::Progress, threading}; +pub use gix_features::{ + parallel, + progress::{Count, DynNestedProgress, 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(all(feature = "gix-protocol"))] +#[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; +#[cfg(feature = "status")] +pub use gix_status as status; 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)] @@ -101,13 +137,13 @@ pub use hash::{oid, ObjectId}; pub mod interrupt; -/// -pub mod attributes; - mod ext; /// pub mod prelude; +#[cfg(feature = "excludes")] +mod attribute_stack; + /// pub mod path; @@ -118,11 +154,14 @@ pub type OdbHandle = gix_odb::Handle; /// A way to access git configuration 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, PathspecDetached, Submodule}; /// pub mod clone; @@ -130,8 +169,12 @@ 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; /// @@ -217,12 +260,14 @@ fn open_opts_with_git_binary_config() -> open::Options { /// See [`ThreadSafeRepository::open()`], but returns a [`Repository`] instead. #[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) } /// See [`ThreadSafeRepository::open_opts()`], but returns a [`Repository`] instead. #[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) } @@ -237,6 +282,7 @@ pub mod open; pub mod config; /// +#[cfg(feature = "mailmap")] pub mod mailmap; /// @@ -244,6 +290,9 @@ pub mod worktree; pub mod revision; +#[cfg(feature = "attributes")] +pub mod filter; + /// pub mod remote; |