From ae27a5e30c6cde88056f3e685c1214f21b4a8fe2 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 7 Sep 2024 11:12:59 +0200 Subject: [PATCH] update crate-status to inform about tree-editing capabilities --- Cargo.lock | 52 ++++++++++++------------- Cargo.toml | 1 + crate-status.md | 2 + gix-config/src/file/access/read_only.rs | 9 +++-- gix-config/src/file/util.rs | 4 +- gix-index/src/access/mod.rs | 2 +- gix-submodule/src/access.rs | 2 +- gix/src/worktree/mod.rs | 1 + 8 files changed, 40 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 98685e9f009..d923e259f57 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1447,9 +1447,9 @@ checksum = "ebccbf25aa4a973dd352564a9000af69edca90623e8a16dad9cbc03713131311" dependencies = [ "bstr", "gix-glob 0.16.5 (registry+https://github.com/rust-lang/crates.io-index)", - "gix-path 0.10.10", + "gix-path 0.10.11 (registry+https://github.com/rust-lang/crates.io-index)", "gix-quote 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "gix-trace 0.1.9", + "gix-trace 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "kstring", "smallvec", "thiserror", @@ -1702,7 +1702,7 @@ dependencies = [ "dunce", "gix-fs 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", "gix-hash 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)", - "gix-path 0.10.10", + "gix-path 0.10.11 (registry+https://github.com/rust-lang/crates.io-index)", "gix-ref 0.44.1", "gix-sec 0.10.8 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", @@ -1759,7 +1759,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac7045ac9fe5f9c727f38799d002a7ed3583cd777e3322a7c4b43e3cf437dc69" dependencies = [ "gix-hash 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)", - "gix-trace 0.1.9", + "gix-trace 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "gix-utils 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "libc", "prodash 28.0.0", @@ -1849,7 +1849,7 @@ dependencies = [ "bitflags 2.6.0", "bstr", "gix-features 0.38.2 (registry+https://github.com/rust-lang/crates.io-index)", - "gix-path 0.10.10", + "gix-path 0.10.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1917,8 +1917,8 @@ checksum = "e447cd96598460f5906a0f6c75e950a39f98c2705fc755ad2f2020c9e937fab7" dependencies = [ "bstr", "gix-glob 0.16.5 (registry+https://github.com/rust-lang/crates.io-index)", - "gix-path 0.10.10", - "gix-trace 0.1.9", + "gix-path 0.10.11 (registry+https://github.com/rust-lang/crates.io-index)", + "gix-trace 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-bom", ] @@ -2218,31 +2218,31 @@ dependencies = [ [[package]] name = "gix-path" -version = "0.10.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d5b8722112fa2fa87135298780bc833b0e9f6c56cc82795d209804b3a03484" +version = "0.10.11" dependencies = [ "bstr", - "gix-trace 0.1.9", + "gix-testtools", + "gix-trace 0.1.10", "home", + "known-folders", "once_cell", + "serial_test", "thiserror", + "windows 0.58.0", + "winreg", ] [[package]] name = "gix-path" version = "0.10.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebfc4febd088abdcbc9f1246896e57e37b7a34f6909840045a1767c6dafac7af" dependencies = [ "bstr", - "gix-testtools", - "gix-trace 0.1.10", + "gix-trace 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "home", - "known-folders", "once_cell", - "serial_test", "thiserror", - "windows 0.58.0", - "winreg", ] [[package]] @@ -2336,7 +2336,7 @@ dependencies = [ "gix-hash 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)", "gix-lock 14.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "gix-object 0.42.3", - "gix-path 0.10.10", + "gix-path 0.10.11 (registry+https://github.com/rust-lang/crates.io-index)", "gix-tempfile 14.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "gix-utils 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "gix-validate 0.8.5", @@ -2467,7 +2467,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fe4d52f30a737bbece5276fab5d3a8b276dc2650df963e293d0673be34e7a5f" dependencies = [ "bitflags 2.6.0", - "gix-path 0.10.10", + "gix-path 0.10.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc", "windows-sys 0.52.0", ] @@ -2597,12 +2597,6 @@ dependencies = [ name = "gix-tix" version = "0.0.0" -[[package]] -name = "gix-trace" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f924267408915fddcd558e3f37295cc7d6a3e50f8bd8b606cee0808c3915157e" - [[package]] name = "gix-trace" version = "0.1.10" @@ -2611,6 +2605,12 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "gix-trace" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cae0e8661c3ff92688ce1c8b8058b3efb312aba9492bbe93661a21705ab431b" + [[package]] name = "gix-transport" version = "0.42.3" @@ -2756,7 +2756,7 @@ dependencies = [ "gix-ignore 0.11.4 (registry+https://github.com/rust-lang/crates.io-index)", "gix-index 0.33.1", "gix-object 0.42.3", - "gix-path 0.10.10", + "gix-path 0.10.11 (registry+https://github.com/rust-lang/crates.io-index)", "gix-validate 0.8.5", ] diff --git a/Cargo.toml b/Cargo.toml index a4d4a2ad2fe..c4fe1097bc4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -390,3 +390,4 @@ unnecessary_join = "allow" # x1 stable_sort_primitive = "allow" # x1 no_effect_underscore_binding = "allow" # x1 empty_docs = "allow" +too_long_first_doc_paragraph = "allow" \ No newline at end of file diff --git a/crate-status.md b/crate-status.md index ee017c8ef69..b34dffa0754 100644 --- a/crate-status.md +++ b/crate-status.md @@ -97,6 +97,7 @@ The top-level crate that acts as hub to all functionality provided by the `gix-* * [ ] create [signed commits and tags](https://github.com/Byron/gitoxide/issues/12) * **trees** * [x] lookup path + * [x] edit * **references** * [x] peel to end * [x] ref-log access @@ -213,6 +214,7 @@ The top-level crate that acts as hub to all functionality provided by the `gix-* * [x] tag * [x] [name validation][tagname-validation] * [x] transform borrowed to owned objects +* [x] edit trees efficiently and write changes back * [x] API documentation * [ ] Some examples diff --git a/gix-config/src/file/access/read_only.rs b/gix-config/src/file/access/read_only.rs index cd5c4aff062..c003dea974b 100644 --- a/gix-config/src/file/access/read_only.rs +++ b/gix-config/src/file/access/read_only.rs @@ -312,7 +312,10 @@ impl<'event> File<'event> { /// # Ok::<(), Box>(()) /// ``` #[must_use] - pub fn sections_by_name<'a>(&'a self, name: &'a str) -> Option> + '_> { + pub fn sections_by_name<'a>( + &'a self, + name: &'a str, + ) -> Option> + 'a> { self.section_ids_by_name(name).ok().map(move |ids| { ids.map(move |id| { self.sections @@ -328,7 +331,7 @@ impl<'event> File<'event> { pub fn sections_and_ids_by_name<'a>( &'a self, name: &'a str, - ) -> Option, SectionId)> + '_> { + ) -> Option, SectionId)> + 'a> { self.section_ids_by_name(name).ok().map(move |ids| { ids.map(move |id| { ( @@ -347,7 +350,7 @@ impl<'event> File<'event> { &'a self, name: &'a str, filter: &'a mut MetadataFilter, - ) -> Option> + '_> { + ) -> Option> + 'a> { self.section_ids_by_name(name).ok().map(move |ids| { ids.filter_map(move |id| { let s = self diff --git a/gix-config/src/file/util.rs b/gix-config/src/file/util.rs index 78bc4736f63..a04650511c4 100644 --- a/gix-config/src/file/util.rs +++ b/gix-config/src/file/util.rs @@ -118,7 +118,7 @@ impl<'event> File<'event> { &'a self, section_name: &'a str, subsection_name: Option<&BStr>, - ) -> Result + DoubleEndedIterator + '_, lookup::existing::Error> { + ) -> Result + DoubleEndedIterator + 'a, lookup::existing::Error> { let section_name = section::Name::from_str_unchecked(section_name); let section_ids = self .section_lookup_tree @@ -146,7 +146,7 @@ impl<'event> File<'event> { pub(crate) fn section_ids_by_name<'a>( &'a self, section_name: &'a str, - ) -> Result + '_, lookup::existing::Error> { + ) -> Result + 'a, lookup::existing::Error> { let section_name = section::Name::from_str_unchecked(section_name); match self.section_lookup_tree.get(§ion_name) { Some(lookup) => { diff --git a/gix-index/src/access/mod.rs b/gix-index/src/access/mod.rs index 1eb72e7158c..36b80ad69e4 100644 --- a/gix-index/src/access/mod.rs +++ b/gix-index/src/access/mod.rs @@ -215,7 +215,7 @@ impl State { directory: &BStr, ignore_case: bool, lookup: &AccelerateLookup<'a>, - ) -> Option<&Entry> { + ) -> Option<&'a Entry> { lookup .icase_dirs .find(AccelerateLookup::icase_hash(directory), |dir| { diff --git a/gix-submodule/src/access.rs b/gix-submodule/src/access.rs index c1fdbf9b768..deba9a14007 100644 --- a/gix-submodule/src/access.rs +++ b/gix-submodule/src/access.rs @@ -56,7 +56,7 @@ impl File { ) -> bool + 'a), ) -> Result< - impl Iterator)> + 'a, + impl Iterator)> + 'a, crate::is_active_platform::Error, > { let mut platform = self.is_active_platform(config, defaults)?; diff --git a/gix/src/worktree/mod.rs b/gix/src/worktree/mod.rs index 7f5709e7d18..890f140a0d7 100644 --- a/gix/src/worktree/mod.rs +++ b/gix/src/worktree/mod.rs @@ -22,6 +22,7 @@ pub type Index = gix_fs::SharedFileSnapshot; /// A type to represent an index which either was loaded from disk as it was persisted there, or created on the fly in memory. #[cfg(feature = "index")] +#[allow(clippy::large_enum_variant)] pub enum IndexPersistedOrInMemory { /// The index as loaded from disk, and shared across clones of the owning `Repository`. Persisted(Index),