Skip to content

Commit

Permalink
Merge branch 'optimizations'
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Sep 8, 2023
2 parents a1ed6a1 + 805b8aa commit 6135a5e
Show file tree
Hide file tree
Showing 98 changed files with 968 additions and 632 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ max = ["max-control", "fast", "gitoxide-core-blocking-client", "http-client-curl
max-pure = ["max-control", "gix-features/rustsha1", "gix-features/zlib-rust-backend", "http-client-reqwest", "gitoxide-core-blocking-client" ]

## Like `max`, but with more control for configuration. See the *Package Maintainers* headline for more information.
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" ]
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" ]

## All of the good stuff, with less fanciness for smaller binaries.
##
Expand Down
4 changes: 2 additions & 2 deletions gitoxide-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ serde = ["gix/serde", "dep:serde_json", "dep:serde", "bytesize/serde"]

[dependencies]
# deselect everything else (like "performance") as this should be controllable by the parent application.
gix = { version = "^0.53.0", path = "../gix", default-features = false }
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"] }
gix = { version = "^0.53.0", path = "../gix", default-features = false, features = ["blob-diff", "revision", "mailmap", "excludes", "attributes", "worktree-mutation", "credentials", "interrupt"] }
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"] }
gix-transport-configuration-only = { package = "gix-transport", version = "^0.35.0", path = "../gix-transport", default-features = false }
gix-archive-for-configuration-only = { package = "gix-archive", version = "^0.3.0", path = "../gix-archive", optional = true, features = ["tar", "tar_gz"] }
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"] }
Expand Down
6 changes: 3 additions & 3 deletions gitoxide-core/src/repository/exclude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::borrow::Cow;
use std::io;

use anyhow::{anyhow, bail};
use gix::{bstr::BStr, prelude::FindExt};
use gix::bstr::BStr;

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

Expand Down Expand Up @@ -49,7 +49,7 @@ pub fn query(
.metadata()
.ok()
.map(|m| m.is_dir());
let entry = cache.at_entry(path.as_slice(), is_dir, |oid, buf| repo.objects.find_blob(oid, buf))?;
let entry = cache.at_entry(path.as_slice(), is_dir)?;
let match_ = entry
.matching_exclude_pattern()
.and_then(|m| (show_ignore_patterns || !m.pattern.is_negative()).then_some(m));
Expand All @@ -68,7 +68,7 @@ pub fn query(
.index_entries_with_paths(&index)
.ok_or_else(|| anyhow!("Pathspec didn't yield any entry"))?
{
let entry = cache.at_entry(path, Some(false), |oid, buf| repo.objects.find_blob(oid, buf))?;
let entry = cache.at_entry(path, Some(false))?;
let match_ = entry
.matching_exclude_pattern()
.and_then(|m| (show_ignore_patterns || !m.pattern.is_negative()).then_some(m));
Expand Down
2 changes: 1 addition & 1 deletion gix-archive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ document-features = { version = "0.2.0", optional = true }
[dev-dependencies]
gix-testtools = { path = "../tests/tools"}
gix-odb = { path = "../gix-odb"}
gix-worktree = { path = "../gix-worktree"}
gix-worktree = { path = "../gix-worktree", default-features = false, features = ["attributes"]}
gix-hash = { path = "../gix-hash"}
gix-attributes = { path = "../gix-attributes"}
gix-object = { path = "../gix-object"}
Expand Down
2 changes: 1 addition & 1 deletion gix-attributes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ serde = ["dep:serde", "bstr/serde", "gix-glob/serde", "kstring/serde"]
gix-path = { version = "^0.9.0", path = "../gix-path" }
gix-quote = { version = "^0.4.7", path = "../gix-quote" }
gix-glob = { version = "^0.11.0", path = "../gix-glob" }
gix-trace = { version = "^0.1.3", path = "../gix-trace" }

bstr = { version = "1.3.0", default-features = false, features = ["std", "unicode"]}
smallvec = "1.10.0"
kstring = "2.0.0"
unicode-bom = "2.0.2"
thiserror = "1.0.26"
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]}
log = "0.4.17"

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

Expand Down
10 changes: 5 additions & 5 deletions gix-attributes/src/search/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl Search {
impl Pattern for Attributes {
type Value = Value;

fn bytes_to_patterns(bytes: &[u8], source: &std::path::Path) -> Vec<pattern::Mapping<Self::Value>> {
fn bytes_to_patterns(bytes: &[u8], _source: &std::path::Path) -> Vec<pattern::Mapping<Self::Value>> {
fn into_owned_assignments<'a>(
attrs: impl Iterator<Item = Result<crate::AssignmentRef<'a>, crate::name::Error>>,
) -> Option<Assignments> {
Expand All @@ -138,8 +138,8 @@ impl Pattern for Attributes {
.collect::<Result<Assignments, _>>();
match res {
Ok(res) => Some(res),
Err(err) => {
log::warn!("{}", err);
Err(_err) => {
gix_trace::warn!("{}", _err);
None
}
}
Expand All @@ -148,8 +148,8 @@ impl Pattern for Attributes {
crate::parse(bytes)
.filter_map(|res| match res {
Ok(pattern) => Some(pattern),
Err(err) => {
log::warn!("{}: {}", source.display(), err);
Err(_err) => {
gix_trace::warn!("{}: {}", _source.display(), _err);
None
}
})
Expand Down
1 change: 0 additions & 1 deletion gix-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ gix-sec = { version = "^0.9.0", path = "../gix-sec" }
gix-ref = { version = "^0.35.0", path = "../gix-ref" }
gix-glob = { version = "^0.11.0", path = "../gix-glob" }

log = "0.4.17"
winnow = { version = "0.5.14", features = ["simd"] }
memchr = "2"
thiserror = "1.0.26"
Expand Down
4 changes: 2 additions & 2 deletions gix-config/src/file/init/from_paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl File<'static> {
Err(err) => {
let err = Error::Io { source: err, path };
if options.ignore_io_errors {
log::warn!("ignoring: {err:#?}");
gix_features::trace::warn!("ignoring: {err:#?}");
continue;
} else {
return Err(err);
Expand All @@ -104,7 +104,7 @@ impl File<'static> {
Ok(_) => {}
Err(err) => {
if options.ignore_io_errors {
log::warn!(
gix_features::trace::warn!(
"ignoring: {:#?}",
Error::Io {
source: err,
Expand Down
2 changes: 1 addition & 1 deletion gix-config/tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ path = "config.rs"
[dev-dependencies]
gix-config = { path = ".."}
gix-testtools = { path = "../../tests/tools"}
gix = { path = "../../gix" }
gix = { path = "../../gix", default-features = false }
gix-ref = { path = "../../gix-ref" }
gix-path = { path = "../../gix-path" }
gix-sec = { path = "../../gix-sec" }
Expand Down
2 changes: 1 addition & 1 deletion gix-filter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ smallvec = "1.10.0"
[dev-dependencies]
once_cell = "1.18.0"
gix-testtools = { path = "../tests/tools" }
gix-worktree = { path = "../gix-worktree" }
gix-worktree = { path = "../gix-worktree", default-features = false, features = ["attributes"] }
2 changes: 1 addition & 1 deletion gix-index/tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ gix-features-parallel = ["gix-features/parallel"]
gix-index = { path = ".." }
gix-features = { path = "../../gix-features", features = ["rustsha1", "progress"] }
gix-testtools = { path = "../../tests/tools"}
gix = { path = "../../gix"}
gix = { path = "../../gix", default-features = false, features = ["index"] }
gix-hash = { path = "../../gix-hash"}
filetime = "0.2.15"
bstr = { version = "1.3.0", default-features = false }
2 changes: 1 addition & 1 deletion gix-odb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ gix-date = { version = "^0.7.4", path = "../gix-date" }
gix-path = { version = "^0.9.0", path = "../gix-path" }
gix-quote = { version = "^0.4.7", path = "../gix-quote" }
gix-object = { version = "^0.35.0", path = "../gix-object" }
gix-pack = { version = "^0.41.0", path = "../gix-pack" }
gix-pack = { version = "^0.41.0", path = "../gix-pack", default-features = false }
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]}

tempfile = "3.1.0"
Expand Down
16 changes: 12 additions & 4 deletions gix-pack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ autotests = false
doctest = false

[features]

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

[dependencies]
gix-features = { version = "^0.33.0", path = "../gix-features", features = ["crc32", "rustsha1", "progress", "zlib"] }
gix-path = { version = "^0.9.0", path = "../gix-path" }
gix-hash = { version = "^0.12.0", path = "../gix-hash" }
gix-chunk = { version = "^0.4.4", path = "../gix-chunk" }
gix-object = { version = "^0.35.0", path = "../gix-object" }
gix-traverse = { version = "^0.31.0", path = "../gix-traverse" }
gix-diff = { version = "^0.34.0", path = "../gix-diff" }
gix-hashtable = { version = "^0.3.0", path = "../gix-hashtable" }

# for streaming of packs (input, output)
gix-traverse = { version = "^0.31.0", path = "../gix-traverse", optional = true }
gix-diff = { version = "^0.34.0", path = "../gix-diff", default-features = false, optional = true }

memmap2 = "0.7.0"
smallvec = "1.3.0"
parking_lot = { version = "0.12.0", default-features = false }
thiserror = "1.0.26"

# for caching
uluru = { version = "3.0.0", optional = true }
clru = { version = "0.6.1", optional = true }

Expand Down
2 changes: 1 addition & 1 deletion gix-pack/src/bundle/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pub mod init;

mod find;
///
#[cfg(not(feature = "wasm"))]
#[cfg(all(not(feature = "wasm"), feature = "streaming-input"))]
pub mod write;

///
Expand Down
5 changes: 2 additions & 3 deletions gix-pack/src/data/input/entries_to_bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,11 @@ where
}
self.num_entries += 1;
entry.header.write_to(entry.decompressed_size, &mut self.output)?;
std::io::copy(
&mut entry
self.output.write_all(
entry
.compressed
.as_deref()
.expect("caller must configure generator to keep compressed bytes"),
&mut self.output,
)?;
Ok(entry)
}
Expand Down
2 changes: 2 additions & 0 deletions gix-pack/src/data/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ pub mod init {
pub mod entry;

///
#[cfg(feature = "streaming-input")]
pub mod input;

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

/// A slice into a pack file denoting a pack entry.
Expand Down
Loading

0 comments on commit 6135a5e

Please sign in to comment.