This also removes all diff capabilities.
Unified · Split
| @@ -58,7 +58,7 @@ default = ["max-performance-safe", "comfort", "extras"] · 57 unmodified lines | ||
| 58 | 58 | #! Bundles are for convenience only and bear no further meaning beyond the cargo manifest file. |
| 59 | 59 | |
| 60 | 60 | ## Various additional features and capabilities that are not necessarily part of what most users would need. |
| 61 | −extras = ["worktree-stream", "worktree-archive"] | |
| 61 | +extras = ["worktree-stream", "worktree-archive", "blob-diff"] | |
| 62 | 62 | |
| 63 | 63 | ## Various progress-related features that improve the look of progress message units. |
| 64 | 64 | comfort = ["gix-features/progress-unit-bytes", "gix-features/progress-unit-human-numbers"] |
| @@ -68,6 +68,10 @@ comfort = ["gix-features/progress-unit-bytes", "gix-features/progress-unit-human · 3 unmodified lines | ||
| 68 | 68 | #! A component is a distinct feature which may be comprised of one or more methods around a particular topic. |
| 69 | 69 | #! Providers of libraries should only activate |
| 70 | 70 | |
| 71 | +## Make it possible to diff blobs line by line. Note that this feature is integral for implementing tree-diffs as well due to the handling of rename-tracking, | |
| 72 | +## which relies on line-by-line diffs in some cases. | |
| 73 | +blob-diff = ["gix-diff/blob"] | |
| 74 | + | |
| 71 | 75 | ## Make it possible to turn a tree into a stream of bytes, which can be decoded to entries and turned into various other formats. |
| 72 | 76 | worktree-stream = ["gix-worktree-stream"] |
| 73 | 77 | |
| @@ -189,7 +193,7 @@ gix-negotiate = { version = "^0.6.0", path = "../gix-negotiate" } · 115 unmodified lines | ||
| 189 | 193 | gix-path = { version = "^0.9.0", path = "../gix-path" } |
| 190 | 194 | gix-url = { version = "^0.22.0", path = "../gix-url" } |
| 191 | 195 | gix-traverse = { version = "^0.31.0", path = "../gix-traverse" } |
| 192 | −gix-diff = { version = "^0.34.0", path = "../gix-diff" } | |
| 196 | +gix-diff = { version = "^0.34.0", path = "../gix-diff", default-features = false } | |
| 193 | 197 | gix-mailmap = { version = "^0.17.0", path = "../gix-mailmap" } |
| 194 | 198 | gix-features = { version = "^0.33.0", path = "../gix-features", features = ["progress", "once_cell"] } |
| 195 | 199 | gix-trace = { version = "^0.1.3", path = "../gix-trace" } |
| @@ -9,7 +9,7 @@ use crate::{ · 8 unmodified lines | ||
| 9 | 9 | config, |
| 10 | 10 | config::{ |
| 11 | 11 | boolean, |
| 12 | − cache::util::{ApplyLeniency, ApplyLeniencyDefault, ApplyLeniencyDefaultValue}, | |
| 12 | + cache::util::{ApplyLeniency, ApplyLeniencyDefaultValue}, | |
| 13 | 13 | checkout_options, |
| 14 | 14 | tree::{gitoxide, Checkout, Core, Key}, |
| 15 | 15 | Cache, |
| @@ -21,7 +21,9 @@ use crate::{ · 5 unmodified lines | ||
| 21 | 21 | |
| 22 | 22 | /// Access |
| 23 | 23 | impl Cache { |
| 24 | + #[cfg(feature = "blob-diff")] | |
| 24 | 25 | pub(crate) fn diff_algorithm(&self) -> Result<gix_diff::blob::Algorithm, config::diff::algorithm::Error> { |
| 26 | + use crate::config::cache::util::ApplyLeniencyDefault; | |
| 25 | 27 | use crate::config::diff::algorithm::Error; |
| 26 | 28 | self.diff_algorithm |
| 27 | 29 | .get_or_try_init(|| { |
| @@ -82,6 +84,7 @@ impl Cache { · 54 unmodified lines | ||
| 82 | 84 | }) |
| 83 | 85 | } |
| 84 | 86 | |
| 87 | + #[cfg(feature = "blob-diff")] | |
| 85 | 88 | pub(crate) fn diff_renames( |
| 86 | 89 | &self, |
| 87 | 90 | ) -> Result<Option<crate::object::tree::diff::Rewrites>, crate::object::tree::diff::rewrites::Error> { |
| @@ -174,9 +174,11 @@ impl Cache { · 173 unmodified lines | ||
| 174 | 174 | user_agent: Default::default(), |
| 175 | 175 | personas: Default::default(), |
| 176 | 176 | url_rewrite: Default::default(), |
| 177 | + #[cfg(feature = "blob-diff")] | |
| 177 | 178 | diff_renames: Default::default(), |
| 178 | 179 | #[cfg(any(feature = "blocking-network-client", feature = "async-network-client"))] |
| 179 | 180 | url_scheme: Default::default(), |
| 181 | + #[cfg(feature = "blob-diff")] | |
| 180 | 182 | diff_algorithm: Default::default(), |
| 181 | 183 | }) |
| 182 | 184 | } |
| @@ -222,8 +224,11 @@ impl Cache { · 39 unmodified lines | ||
| 222 | 224 | self.user_agent = Default::default(); |
| 223 | 225 | self.personas = Default::default(); |
| 224 | 226 | self.url_rewrite = Default::default(); |
| 225 | − self.diff_renames = Default::default(); | |
| 226 | − self.diff_algorithm = Default::default(); | |
| 227 | + #[cfg(feature = "blob-diff")] | |
| 228 | + { | |
| 229 | + self.diff_renames = Default::default(); | |
| 230 | + self.diff_algorithm = Default::default(); | |
| 231 | + } | |
| 227 | 232 | ( |
| 228 | 233 | self.static_pack_cache_limit_bytes, |
| 229 | 234 | self.pack_cache_bytes, |
| @@ -495,11 +495,13 @@ pub(crate) struct Cache { · 494 unmodified lines | ||
| 495 | 495 | /// A lazily loaded rewrite list for remote urls |
| 496 | 496 | pub(crate) url_rewrite: OnceCell<crate::remote::url::Rewrite>, |
| 497 | 497 | /// The lazy-loaded rename information for diffs. |
| 498 | + #[cfg(feature = "blob-diff")] | |
| 498 | 499 | pub(crate) diff_renames: OnceCell<Option<crate::object::tree::diff::Rewrites>>, |
| 499 | 500 | /// A lazily loaded mapping to know which url schemes to allow |
| 500 | 501 | #[cfg(any(feature = "blocking-network-client", feature = "async-network-client"))] |
| 501 | 502 | pub(crate) url_scheme: OnceCell<crate::remote::url::SchemePermission>, |
| 502 | 503 | /// The algorithm to use when diffing blobs |
| 504 | + #[cfg(feature = "blob-diff")] | |
| 503 | 505 | pub(crate) diff_algorithm: OnceCell<gix_diff::blob::Algorithm>, |
| 504 | 506 | /// The amount of bytes to use for a memory backed delta pack cache. If `Some(0)`, no cache is used, if `None` |
| 505 | 507 | /// a standard cache is used which costs near to nothing and always pays for itself. |
| @@ -31,6 +31,7 @@ pub(crate) mod root { · 30 unmodified lines | ||
| 31 | 31 | /// The `credential` section. |
| 32 | 32 | pub const CREDENTIAL: sections::Credential = sections::Credential; |
| 33 | 33 | /// The `diff` section. |
| 34 | + #[cfg(feature = "blob-diff")] | |
| 34 | 35 | pub const DIFF: sections::Diff = sections::Diff; |
| 35 | 36 | /// The `extensions` section. |
| 36 | 37 | pub const EXTENSIONS: sections::Extensions = sections::Extensions; |
| @@ -69,6 +70,7 @@ pub(crate) mod root { · 32 unmodified lines | ||
| 69 | 70 | &Self::COMMITTER, |
| 70 | 71 | &Self::CORE, |
| 71 | 72 | &Self::CREDENTIAL, |
| 73 | + #[cfg(feature = "blob-diff")] | |
| 72 | 74 | &Self::DIFF, |
| 73 | 75 | &Self::EXTENSIONS, |
| 74 | 76 | &Self::FETCH, |
| @@ -90,10 +92,12 @@ pub(crate) mod root { · 15 unmodified lines | ||
| 90 | 92 | |
| 91 | 93 | mod sections; |
| 92 | 94 | pub use sections::{ |
| 93 | − branch, checkout, core, credential, diff, extensions, fetch, gitoxide, http, index, protocol, remote, ssh, Author, | |
| 94 | − Branch, Checkout, Clone, Committer, Core, Credential, Diff, Extensions, Fetch, Gitoxide, Http, Index, Init, Pack, | |
| 95 | + branch, checkout, core, credential, extensions, fetch, gitoxide, http, index, protocol, remote, ssh, Author, | |
| 96 | + Branch, Checkout, Clone, Committer, Core, Credential, Extensions, Fetch, Gitoxide, Http, Index, Init, Pack, | |
| 95 | 97 | Protocol, Remote, Safe, Ssh, Url, User, |
| 96 | 98 | }; |
| 99 | +#[cfg(feature = "blob-diff")] | |
| 100 | +pub use sections::{diff, Diff}; | |
| 97 | 101 | |
| 98 | 102 | /// Generic value implementations for static instantiation. |
| 99 | 103 | pub mod keys; |
| @@ -37,7 +37,9 @@ pub mod credential; · 36 unmodified lines | ||
| 37 | 37 | |
| 38 | 38 | /// The `diff` top-level section. |
| 39 | 39 | #[derive(Copy, Clone, Default)] |
| 40 | +#[cfg(feature = "blob-diff")] | |
| 40 | 41 | pub struct Diff; |
| 42 | +#[cfg(feature = "blob-diff")] | |
| 41 | 43 | pub mod diff; |
| 42 | 44 | |
| 43 | 45 | /// The `extension` top-level section. |
| @@ -1,4 +1,5 @@ | ||
| 1 | 1 | /// |
| 2 | +#[cfg(feature = "blob-diff")] | |
| 2 | 3 | pub mod diff { |
| 3 | 4 | use std::ops::Range; |
| 4 | 5 | |
| @@ -168,6 +168,7 @@ impl<'repo> Tree<'repo> { · 167 unmodified lines | ||
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /// |
| 171 | +#[cfg(feature = "blob-diff")] | |
| 171 | 172 | pub mod diff; |
| 172 | 173 | |
| 173 | 174 | /// |
| @@ -204,6 +204,7 @@ mod fetch { · 203 unmodified lines | ||
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | +#[cfg(feature = "blob-diff")] | |
| 207 | 208 | mod diff { |
| 208 | 209 | use gix::{ |
| 209 | 210 | config::tree::{Diff, Key}, |
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | use crate::util::{named_repo, named_subrepo_opts}; |
| 2 | 2 | |
| 3 | +#[cfg(feature = "blob-diff")] | |
| 3 | 4 | mod diff; |
| 4 | 5 | |
| 5 | 6 | #[test] |
| @@ -42,6 +42,7 @@ check: · 41 unmodified lines | ||
| 42 | 42 | if cargo check -p gix-packetline --all-features 2>/dev/null; then false; else true; fi |
| 43 | 43 | if cargo check -p gix-transport --all-features 2>/dev/null; then false; else true; fi |
| 44 | 44 | if cargo check -p gix-protocol --all-features 2>/dev/null; then false; else true; fi |
| 45 | + if cargo tree -p gix --no-default-features -i imara-diff 2>/dev/null; then false; else true; fi | |
| 45 | 46 | cargo check --no-default-features --features lean |
| 46 | 47 | cargo check --no-default-features --features lean-async |
| 47 | 48 | cargo check --no-default-features --features max |
| @@ -111,6 +112,7 @@ check: · 63 unmodified lines | ||
| 111 | 112 | cargo check -p gix --no-default-features --features max-performance |
| 112 | 113 | cargo check -p gix --no-default-features --features max-performance-safe |
| 113 | 114 | cargo check -p gix --no-default-features --features progress-tree |
| 115 | + cargo check -p gix --no-default-features --features blob-diff | |
| 114 | 116 | cargo check -p gix --no-default-features |
| 115 | 117 | cargo check -p gix-odb --features serde |
| 116 | 118 | cargo check --no-default-features --features max-control |