Skip to content

Commit 6135a5e

Browse files
committed
Merge branch 'optimizations'
2 parents a1ed6a1 + 805b8aa commit 6135a5e

File tree

98 files changed

+968
-632
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+968
-632
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ max = ["max-control", "fast", "gitoxide-core-blocking-client", "http-client-curl
4444
max-pure = ["max-control", "gix-features/rustsha1", "gix-features/zlib-rust-backend", "http-client-reqwest", "gitoxide-core-blocking-client" ]
4545

4646
## Like `max`, but with more control for configuration. See the *Package Maintainers* headline for more information.
47-
max-control = ["tracing", "fast-safe", "pretty-cli", "gitoxide-core-tools-query", "gitoxide-core-tools-corpus", "gitoxide-core-tools", "prodash-render-line", "prodash-render-tui", "prodash/render-line-autoconfigure", "gix/regex" ]
47+
max-control = ["tracing", "fast-safe", "pretty-cli", "gitoxide-core-tools-query", "gitoxide-core-tools-corpus", "gitoxide-core-tools", "prodash-render-line", "prodash-render-tui", "prodash/render-line-autoconfigure", "gix/revparse-regex" ]
4848

4949
## All of the good stuff, with less fanciness for smaller binaries.
5050
##

gitoxide-core/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ serde = ["gix/serde", "dep:serde_json", "dep:serde", "bytesize/serde"]
4444

4545
[dependencies]
4646
# deselect everything else (like "performance") as this should be controllable by the parent application.
47-
gix = { version = "^0.53.0", path = "../gix", default-features = false }
48-
gix-pack-for-configuration-only = { package = "gix-pack", version = "^0.41.0", path = "../gix-pack", default-features = false, features = ["pack-cache-lru-dynamic", "pack-cache-lru-static"] }
47+
gix = { version = "^0.53.0", path = "../gix", default-features = false, features = ["blob-diff", "revision", "mailmap", "excludes", "attributes", "worktree-mutation", "credentials", "interrupt"] }
48+
gix-pack-for-configuration-only = { package = "gix-pack", version = "^0.41.0", path = "../gix-pack", default-features = false, features = ["pack-cache-lru-dynamic", "pack-cache-lru-static", "generate", "streaming-input"] }
4949
gix-transport-configuration-only = { package = "gix-transport", version = "^0.35.0", path = "../gix-transport", default-features = false }
5050
gix-archive-for-configuration-only = { package = "gix-archive", version = "^0.3.0", path = "../gix-archive", optional = true, features = ["tar", "tar_gz"] }
5151
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"] }

gitoxide-core/src/repository/exclude.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::borrow::Cow;
22
use std::io;
33

44
use anyhow::{anyhow, bail};
5-
use gix::{bstr::BStr, prelude::FindExt};
5+
use gix::bstr::BStr;
66

77
use crate::{repository::PathsOrPatterns, OutputFormat};
88

@@ -49,7 +49,7 @@ pub fn query(
4949
.metadata()
5050
.ok()
5151
.map(|m| m.is_dir());
52-
let entry = cache.at_entry(path.as_slice(), is_dir, |oid, buf| repo.objects.find_blob(oid, buf))?;
52+
let entry = cache.at_entry(path.as_slice(), is_dir)?;
5353
let match_ = entry
5454
.matching_exclude_pattern()
5555
.and_then(|m| (show_ignore_patterns || !m.pattern.is_negative()).then_some(m));
@@ -68,7 +68,7 @@ pub fn query(
6868
.index_entries_with_paths(&index)
6969
.ok_or_else(|| anyhow!("Pathspec didn't yield any entry"))?
7070
{
71-
let entry = cache.at_entry(path, Some(false), |oid, buf| repo.objects.find_blob(oid, buf))?;
71+
let entry = cache.at_entry(path, Some(false))?;
7272
let match_ = entry
7373
.matching_exclude_pattern()
7474
.and_then(|m| (show_ignore_patterns || !m.pattern.is_negative()).then_some(m));

gix-archive/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ document-features = { version = "0.2.0", optional = true }
4343
[dev-dependencies]
4444
gix-testtools = { path = "../tests/tools"}
4545
gix-odb = { path = "../gix-odb"}
46-
gix-worktree = { path = "../gix-worktree"}
46+
gix-worktree = { path = "../gix-worktree", default-features = false, features = ["attributes"]}
4747
gix-hash = { path = "../gix-hash"}
4848
gix-attributes = { path = "../gix-attributes"}
4949
gix-object = { path = "../gix-object"}

gix-attributes/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ serde = ["dep:serde", "bstr/serde", "gix-glob/serde", "kstring/serde"]
2020
gix-path = { version = "^0.9.0", path = "../gix-path" }
2121
gix-quote = { version = "^0.4.7", path = "../gix-quote" }
2222
gix-glob = { version = "^0.11.0", path = "../gix-glob" }
23+
gix-trace = { version = "^0.1.3", path = "../gix-trace" }
2324

2425
bstr = { version = "1.3.0", default-features = false, features = ["std", "unicode"]}
2526
smallvec = "1.10.0"
2627
kstring = "2.0.0"
2728
unicode-bom = "2.0.2"
2829
thiserror = "1.0.26"
2930
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]}
30-
log = "0.4.17"
3131

3232
document-features = { version = "0.2.1", optional = true }
3333

gix-attributes/src/search/attributes.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl Search {
124124
impl Pattern for Attributes {
125125
type Value = Value;
126126

127-
fn bytes_to_patterns(bytes: &[u8], source: &std::path::Path) -> Vec<pattern::Mapping<Self::Value>> {
127+
fn bytes_to_patterns(bytes: &[u8], _source: &std::path::Path) -> Vec<pattern::Mapping<Self::Value>> {
128128
fn into_owned_assignments<'a>(
129129
attrs: impl Iterator<Item = Result<crate::AssignmentRef<'a>, crate::name::Error>>,
130130
) -> Option<Assignments> {
@@ -138,8 +138,8 @@ impl Pattern for Attributes {
138138
.collect::<Result<Assignments, _>>();
139139
match res {
140140
Ok(res) => Some(res),
141-
Err(err) => {
142-
log::warn!("{}", err);
141+
Err(_err) => {
142+
gix_trace::warn!("{}", _err);
143143
None
144144
}
145145
}
@@ -148,8 +148,8 @@ impl Pattern for Attributes {
148148
crate::parse(bytes)
149149
.filter_map(|res| match res {
150150
Ok(pattern) => Some(pattern),
151-
Err(err) => {
152-
log::warn!("{}: {}", source.display(), err);
151+
Err(_err) => {
152+
gix_trace::warn!("{}: {}", _source.display(), _err);
153153
None
154154
}
155155
})

gix-config/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ gix-sec = { version = "^0.9.0", path = "../gix-sec" }
2424
gix-ref = { version = "^0.35.0", path = "../gix-ref" }
2525
gix-glob = { version = "^0.11.0", path = "../gix-glob" }
2626

27-
log = "0.4.17"
2827
winnow = { version = "0.5.14", features = ["simd"] }
2928
memchr = "2"
3029
thiserror = "1.0.26"

gix-config/src/file/init/from_paths.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl File<'static> {
9292
Err(err) => {
9393
let err = Error::Io { source: err, path };
9494
if options.ignore_io_errors {
95-
log::warn!("ignoring: {err:#?}");
95+
gix_features::trace::warn!("ignoring: {err:#?}");
9696
continue;
9797
} else {
9898
return Err(err);
@@ -104,7 +104,7 @@ impl File<'static> {
104104
Ok(_) => {}
105105
Err(err) => {
106106
if options.ignore_io_errors {
107-
log::warn!(
107+
gix_features::trace::warn!(
108108
"ignoring: {:#?}",
109109
Error::Io {
110110
source: err,

gix-config/tests/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ path = "config.rs"
1717
[dev-dependencies]
1818
gix-config = { path = ".."}
1919
gix-testtools = { path = "../../tests/tools"}
20-
gix = { path = "../../gix" }
20+
gix = { path = "../../gix", default-features = false }
2121
gix-ref = { path = "../../gix-ref" }
2222
gix-path = { path = "../../gix-path" }
2323
gix-sec = { path = "../../gix-sec" }

gix-filter/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ smallvec = "1.10.0"
3030
[dev-dependencies]
3131
once_cell = "1.18.0"
3232
gix-testtools = { path = "../tests/tools" }
33-
gix-worktree = { path = "../gix-worktree" }
33+
gix-worktree = { path = "../gix-worktree", default-features = false, features = ["attributes"] }

gix-index/tests/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ gix-features-parallel = ["gix-features/parallel"]
2020
gix-index = { path = ".." }
2121
gix-features = { path = "../../gix-features", features = ["rustsha1", "progress"] }
2222
gix-testtools = { path = "../../tests/tools"}
23-
gix = { path = "../../gix"}
23+
gix = { path = "../../gix", default-features = false, features = ["index"] }
2424
gix-hash = { path = "../../gix-hash"}
2525
filetime = "0.2.15"
2626
bstr = { version = "1.3.0", default-features = false }

gix-odb/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ gix-date = { version = "^0.7.4", path = "../gix-date" }
2424
gix-path = { version = "^0.9.0", path = "../gix-path" }
2525
gix-quote = { version = "^0.4.7", path = "../gix-quote" }
2626
gix-object = { version = "^0.35.0", path = "../gix-object" }
27-
gix-pack = { version = "^0.41.0", path = "../gix-pack" }
27+
gix-pack = { version = "^0.41.0", path = "../gix-pack", default-features = false }
2828
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]}
2929

3030
tempfile = "3.1.0"

gix-pack/Cargo.toml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ autotests = false
1414
doctest = false
1515

1616
[features]
17-
17+
default = ["generate", "streaming-input"]
18+
## generate new packs from a set of objects.
19+
generate = ["dep:gix-traverse", "dep:gix-diff"]
20+
## Receive a pack as datastream and resolve it
21+
streaming-input = []
1822
## Provide a fixed-size allocation-free LRU cache for packs. It's useful if caching is desired while keeping the memory footprint
1923
## for the LRU-cache itself low.
2024
pack-cache-lru-static = ["dep:uluru"]
@@ -25,22 +29,26 @@ object-cache-dynamic = ["dep:clru"]
2529
## Data structures implement `serde::Serialize` and `serde::Deserialize`.
2630
serde = ["dep:serde", "gix-object/serde"]
2731
## Make it possible to compile to the `wasm32-unknown-unknown` target.
28-
wasm = ["gix-diff/wasm"]
32+
wasm = ["gix-diff?/wasm"]
2933

3034
[dependencies]
3135
gix-features = { version = "^0.33.0", path = "../gix-features", features = ["crc32", "rustsha1", "progress", "zlib"] }
3236
gix-path = { version = "^0.9.0", path = "../gix-path" }
3337
gix-hash = { version = "^0.12.0", path = "../gix-hash" }
3438
gix-chunk = { version = "^0.4.4", path = "../gix-chunk" }
3539
gix-object = { version = "^0.35.0", path = "../gix-object" }
36-
gix-traverse = { version = "^0.31.0", path = "../gix-traverse" }
37-
gix-diff = { version = "^0.34.0", path = "../gix-diff" }
3840
gix-hashtable = { version = "^0.3.0", path = "../gix-hashtable" }
3941

42+
# for streaming of packs (input, output)
43+
gix-traverse = { version = "^0.31.0", path = "../gix-traverse", optional = true }
44+
gix-diff = { version = "^0.34.0", path = "../gix-diff", default-features = false, optional = true }
45+
4046
memmap2 = "0.7.0"
4147
smallvec = "1.3.0"
4248
parking_lot = { version = "0.12.0", default-features = false }
4349
thiserror = "1.0.26"
50+
51+
# for caching
4452
uluru = { version = "3.0.0", optional = true }
4553
clru = { version = "0.6.1", optional = true }
4654

gix-pack/src/bundle/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pub mod init;
33

44
mod find;
55
///
6-
#[cfg(not(feature = "wasm"))]
6+
#[cfg(all(not(feature = "wasm"), feature = "streaming-input"))]
77
pub mod write;
88

99
///

gix-pack/src/data/input/entries_to_bytes.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,11 @@ where
7373
}
7474
self.num_entries += 1;
7575
entry.header.write_to(entry.decompressed_size, &mut self.output)?;
76-
std::io::copy(
77-
&mut entry
76+
self.output.write_all(
77+
entry
7878
.compressed
7979
.as_deref()
8080
.expect("caller must configure generator to keep compressed bytes"),
81-
&mut self.output,
8281
)?;
8382
Ok(entry)
8483
}

gix-pack/src/data/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ pub mod init {
3737
pub mod entry;
3838

3939
///
40+
#[cfg(feature = "streaming-input")]
4041
pub mod input;
4142

4243
/// Utilities to encode pack data entries and write them to a `Write` implementation to resemble a pack data file.
44+
#[cfg(feature = "generate")]
4345
pub mod output;
4446

4547
/// A slice into a pack file denoting a pack entry.

0 commit comments

Comments
 (0)