diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
commit | c23a457e72abe608715ac76f076f47dc42af07a5 (patch) | |
tree | 2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /vendor/gix/src/types.rs | |
parent | Releasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip |
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/gix/src/types.rs')
-rw-r--r-- | vendor/gix/src/types.rs | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/vendor/gix/src/types.rs b/vendor/gix/src/types.rs index cdb5f731d..0739cdd25 100644 --- a/vendor/gix/src/types.rs +++ b/vendor/gix/src/types.rs @@ -5,6 +5,7 @@ use gix_hash::ObjectId; use crate::{head, remote}; /// A worktree checkout containing the files of the repository in consumable form. +#[derive(Debug, Clone)] pub struct Worktree<'repo> { pub(crate) parent: &'repo Repository, /// The root path of the checkout. @@ -137,7 +138,10 @@ pub struct Repository { /// /// Particularly useful when following linked worktrees and instantiating new equally configured worktree repositories. pub(crate) options: crate::open::Options, + #[cfg(feature = "index")] pub(crate) index: crate::worktree::IndexStorage, + #[cfg(feature = "attributes")] + pub(crate) modules: crate::submodule::ModulesFileStorage, pub(crate) shallow_commits: crate::shallow::CommitsStorage, } @@ -148,6 +152,9 @@ pub struct Repository { /// /// Note that this type purposefully isn't very useful until it is converted into a thread-local repository with `to_thread_local()`, /// it's merely meant to be able to exist in a `Sync` context. +/// +/// Note that it can also cheaply be cloned, and it will retain references to all contained resources. +#[derive(Clone)] pub struct ThreadSafeRepository { /// A store for references to point at objects pub refs: crate::RefStore, @@ -161,7 +168,10 @@ pub struct ThreadSafeRepository { /// options obtained when instantiating this repository for use when following linked worktrees. pub(crate) linked_worktree_options: crate::open::Options, /// The index of this instances worktree. + #[cfg(feature = "index")] pub(crate) index: crate::worktree::IndexStorage, + #[cfg(feature = "attributes")] + pub(crate) modules: crate::submodule::ModulesFileStorage, pub(crate) shallow_commits: crate::shallow::CommitsStorage, } @@ -191,3 +201,46 @@ pub struct Remote<'repo> { // pub(crate) prune_tags: bool, pub(crate) repo: &'repo Repository, } + +/// A utility to make matching against pathspecs simple. +/// +/// Note that to perform pathspec matching, attribute access might need to be provided. For that, we use our own +/// and argue that the implementation is only going to incur costs for it when a pathspec matches *and* has attributes. +/// Should this potential duplication of effort to maintain attribute state be unacceptable, the user may fall back +/// to the underlying plumbing. +#[derive(Clone)] +#[cfg(feature = "attributes")] +pub struct Pathspec<'repo> { + pub(crate) repo: &'repo Repository, + /// The cache to power attribute access. It's only initialized if we have a pattern with attributes. + pub(crate) stack: Option<gix_worktree::Stack>, + /// The prepared search to use for checking matches. + pub(crate) search: gix_pathspec::Search, +} + +/// Like [`Pathspec`], but without a Repository reference and with minimal API. +#[derive(Clone)] +#[cfg(feature = "attributes")] +pub struct PathspecDetached { + /// The cache to power attribute access. It's only initialized if we have a pattern with attributes. + pub stack: Option<gix_worktree::Stack>, + /// The prepared search to use for checking matches. + pub search: gix_pathspec::Search, + /// A thread-safe version of an ODB. + pub odb: gix_odb::HandleArc, +} + +/// A stand-in for the submodule of a particular name. +#[derive(Clone)] +#[cfg(feature = "attributes")] +pub struct Submodule<'repo> { + pub(crate) state: std::rc::Rc<crate::submodule::SharedState<'repo>>, + pub(crate) name: crate::bstr::BString, +} + +/// A utility to access `.gitattributes` and `.gitignore` information efficiently. +#[cfg(any(feature = "attributes", feature = "excludes"))] +pub struct AttributeStack<'repo> { + pub(crate) repo: &'repo Repository, + pub(crate) inner: gix_worktree::Stack, +} |