summaryrefslogtreecommitdiffstats
path: root/vendor/gix-worktree/src/lib.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/gix-worktree/src/lib.rs
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/gix-worktree/src/lib.rs')
-rw-r--r--vendor/gix-worktree/src/lib.rs52
1 files changed, 48 insertions, 4 deletions
diff --git a/vendor/gix-worktree/src/lib.rs b/vendor/gix-worktree/src/lib.rs
index 9a67e0289..2626fe508 100644
--- a/vendor/gix-worktree/src/lib.rs
+++ b/vendor/gix-worktree/src/lib.rs
@@ -1,3 +1,7 @@
+//! A crate with all index-centric functionality that is interacting with a worktree.
+//!
+//! Unless specified differently, all operations need an index file (e.g. `.git/index`) as driver.
+//!
//! ## Feature Flags
#![cfg_attr(
feature = "document-features",
@@ -5,11 +9,51 @@
)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![deny(missing_docs, rust_2018_idioms, unsafe_code)]
+use bstr::BString;
-/// file system related utilities
-pub mod fs;
+///
+pub mod read;
+
+/// A cache for efficiently executing operations on directories and files which are encountered in sorted order.
+/// That way, these operations can be re-used for subsequent invocations in the same directory.
+///
+/// This cache can be configured to create directories efficiently, read git-ignore files and git-attribute files,
+/// in any combination.
+///
+/// A cache for directory creation to reduce the amount of stat calls when creating
+/// directories safely, that is without following symlinks that might be on the way.
+///
+/// As a special case, it offers a 'prefix' which (by itself) is assumed to exist and may contain symlinks.
+/// Everything past that prefix boundary must not contain a symlink. We do this by allowing any input path.
+///
+/// Another added benefit is its ability to store the path of full path of the entry to which leading directories
+/// are to be created to avoid allocating memory.
+///
+/// For this to work, it remembers the last 'good' path to a directory and assumes that all components of it
+/// are still valid, too.
+/// As directories are created, the cache will be adjusted to reflect the latest seen directory.
+///
+/// The caching is only useful if consecutive calls to create a directory are using a sorted list of entries.
+#[derive(Clone)]
+pub struct Cache {
+ stack: gix_fs::Stack,
+ /// tells us what to do as we change paths.
+ state: cache::State,
+ /// A buffer used when reading attribute or ignore files or their respective objects from the object database.
+ buf: Vec<u8>,
+ /// If case folding should happen when looking up attributes or exclusions.
+ case: gix_glob::pattern::Case,
+ /// A lookup table for object ids to read from in some situations when looking up attributes or exclusions.
+ id_mappings: Vec<PathIdMapping>,
+ statistics: cache::Statistics,
+}
+
+pub(crate) type PathIdMapping = (BString, gix_hash::ObjectId);
///
-pub mod index;
+pub mod cache;
+pub mod checkout;
+pub use checkout::function::checkout;
-pub(crate) mod os;
+pub mod status;
+pub use status::function::status;