Skip to content

Commit

Permalink
Merge branch 'main' into filter-refs-by-spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Aug 29, 2022
2 parents 569b7bc + 85a3bed commit cef0b51
Show file tree
Hide file tree
Showing 79 changed files with 1,135 additions and 318 deletions.
44 changes: 22 additions & 22 deletions Cargo.lock

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

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repository = "https://github.com/Byron/gitoxide"
authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"]
edition = "2018"
license = "MIT OR Apache-2.0"
version = "0.15.0"
version = "0.16.0"
default-run = "gix"
include = ["src/**/*", "LICENSE-*", "README.md", "CHANGELOG.md"]
resolver = "2"
Expand Down Expand Up @@ -79,11 +79,11 @@ cache-efficiency-debug = ["git-features/cache-efficiency-debug"]
[dependencies]
anyhow = "1.0.42"

gitoxide-core = { version = "^0.17.0", path = "gitoxide-core" }
git-features = { version = "^0.22.2", path = "git-features" }
git-repository = { version = "^0.22.1", path = "git-repository", default-features = false }
gitoxide-core = { version = "^0.18.0", path = "gitoxide-core" }
git-features = { version = "^0.22.3", path = "git-features" }
git-repository = { version = "^0.23.0", path = "git-repository", default-features = false }

git-transport-for-configuration-only = { package = "git-transport", optional = true, version = "^0.19.2", path = "git-transport" }
git-transport-for-configuration-only = { package = "git-transport", optional = true, version = "^0.19.3", path = "git-transport" }

clap = { version = "3.2.5", features = ["derive", "cargo"] }
prodash = { version = "19.0.0", optional = true, default-features = false }
Expand Down
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,10 @@ check: ## Build all code in suitable configurations
&& cargo check --features blocking-client \
&& cargo check --features async-client
cd git-protocol && if cargo check --all-features 2>/dev/null; then false; else true; fi
cd git-repository && cargo check --no-default-features --features local \
&& cargo check --no-default-features --features async-network-client \
cd git-repository && cargo check --no-default-features --features async-network-client \
&& cargo check --no-default-features --features async-network-client-async-std \
&& cargo check --no-default-features --features blocking-network-client \
&& cargo check --no-default-features --features blocking-network-client,blocking-http-transport \
&& cargo check --no-default-features --features one-stop-shop \
&& cargo check --no-default-features --features max-performance \
&& cargo check --no-default-features --features max-performance-safe \
&& cargo check --no-default-features
Expand Down
4 changes: 2 additions & 2 deletions cargo-smart-release/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cargo-smart-release"
version = "0.11.0"
version = "0.12.0"
authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"]
repository = "https://github.com/Byron/gitoxide"
description = "Cargo subcommand for fearlessly releasing crates in workspaces."
Expand All @@ -24,7 +24,7 @@ test = false
cache-efficiency-debug = ["git-repository/cache-efficiency-debug"]

[dependencies]
git-repository = { version = "^0.22.1", path = "../git-repository", default-features = false, features = ["unstable", "max-performance-safe"] }
git-repository = { version = "^0.23.0", path = "../git-repository", default-features = false, features = ["unstable", "max-performance-safe"] }
anyhow = "1.0.42"
clap = { version = "3.2.5", features = ["derive", "cargo"] }
env_logger = { version = "0.9.0", default-features = false, features = ["humantime", "termcolor", "atty"] }
Expand Down
4 changes: 2 additions & 2 deletions etc/check-package-size.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ echo "in root: gitoxide CLI"
(enter git-bitmap && indent cargo diet -n --package-size-limit 5KB)
(enter git-tempfile && indent cargo diet -n --package-size-limit 30KB)
(enter git-lock && indent cargo diet -n --package-size-limit 20KB)
(enter git-config && indent cargo diet -n --package-size-limit 110KB)
(enter git-config && indent cargo diet -n --package-size-limit 120KB)
(enter git-command && indent cargo diet -n --package-size-limit 5KB)
(enter git-hash && indent cargo diet -n --package-size-limit 20KB)
(enter git-chunk && indent cargo diet -n --package-size-limit 10KB)
Expand All @@ -39,7 +39,7 @@ echo "in root: gitoxide CLI"
(enter git-ref && indent cargo diet -n --package-size-limit 50KB)
(enter git-diff && indent cargo diet -n --package-size-limit 10KB)
(enter git-traverse && indent cargo diet -n --package-size-limit 10KB)
(enter git-url && indent cargo diet -n --package-size-limit 15KB)
(enter git-url && indent cargo diet -n --package-size-limit 20KB)
(enter git-validate && indent cargo diet -n --package-size-limit 5KB)
(enter git-date && indent cargo diet -n --package-size-limit 10KB)
(enter git-filter && indent cargo diet -n --package-size-limit 5KB)
Expand Down
4 changes: 2 additions & 2 deletions experiments/diffing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false

[dependencies]
anyhow = "1"
git-repository = { version = "^0.22.1", path = "../../git-repository", features = ["unstable"] }
git-features-for-config = { package = "git-features", version = "^0.22.2", path = "../../git-features", features = ["cache-efficiency-debug"] }
git-repository = { version = "^0.23.0", path = "../../git-repository", features = ["unstable"] }
git-features-for-config = { package = "git-features", version = "^0.22.3", path = "../../git-features", features = ["cache-efficiency-debug"] }
git2 = "0.14"
rayon = "1.5.0"
47 changes: 30 additions & 17 deletions experiments/diffing/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fn main() -> anyhow::Result<()> {
.to_cache()
.with_pack_cache(|| Box::new(odb::pack::cache::lru::MemoryCappedHashmap::new(cache_size())))
.with_object_cache(|| Box::new(odb::pack::cache::object::MemoryCappedHashmap::new(cache_size())));
move |oid, buf: &mut Vec<u8>| handle.find(oid, buf).ok()
move |oid, buf: &mut Vec<u8>| handle.find(oid, buf)
},
Computation::MultiThreaded,
)?;
Expand All @@ -84,7 +84,7 @@ fn main() -> anyhow::Result<()> {
let handle = db
.to_cache()
.with_object_cache(|| Box::new(odb::pack::cache::object::MemoryCappedHashmap::new(cache_size())));
move |oid, buf: &mut Vec<u8>| handle.find(oid, buf).ok()
move |oid, buf: &mut Vec<u8>| handle.find(oid, buf)
},
Computation::MultiThreaded,
)?;
Expand All @@ -106,7 +106,7 @@ fn main() -> anyhow::Result<()> {
let handle = db
.to_cache()
.with_object_cache(|| Box::new(odb::pack::cache::object::MemoryCappedHashmap::new(cache_size())));
move |oid, buf: &mut Vec<u8>| handle.find(oid, buf).ok()
move |oid, buf: &mut Vec<u8>| handle.find(oid, buf)
},
Computation::SingleThreaded,
)?;
Expand Down Expand Up @@ -185,10 +185,11 @@ fn do_libgit2_treediff(commits: &[ObjectId], repo_dir: &std::path::Path, mode: C
})
}

fn do_gitoxide_tree_diff<C, L>(commits: &[ObjectId], make_find: C, mode: Computation) -> anyhow::Result<usize>
fn do_gitoxide_tree_diff<C, L, E>(commits: &[ObjectId], make_find: C, mode: Computation) -> anyhow::Result<usize>
where
C: Fn() -> L + Sync,
L: for<'b> FnMut(&oid, &'b mut Vec<u8>) -> Option<git_repository::objs::Data<'b>>,
L: for<'b> FnMut(&oid, &'b mut Vec<u8>) -> Result<git_repository::objs::Data<'b>, E>,
E: std::error::Error + Send + Sync + 'static,
{
let changes: usize = match mode {
Computation::MultiThreaded => {
Expand All @@ -205,11 +206,16 @@ where
|(state, buf1, buf2, find), pair| {
let (ca, cb) = (pair[0], pair[1]);
let (ta, tb) = (
tree_iter_by_commit(&ca, buf1, &mut *find),
tree_iter_by_commit(&cb, buf2, &mut *find),
tree_iter_by_commit_res(&ca, buf1, &mut *find),
tree_iter_by_commit_res(&cb, buf2, &mut *find),
);
let mut count = Count::default();
ta.changes_needed(tb, state, |id, buf| find_tree_iter(id, buf, &mut *find), &mut count)?;
diff::tree::Changes::from(ta).needed_to_obtain(
tb,
state,
|id, buf| find_tree_iter_res(id, buf, &mut *find),
&mut count,
)?;
changes.fetch_add(count.0, std::sync::atomic::Ordering::Relaxed);
Ok(())
},
Expand All @@ -226,35 +232,42 @@ where
for pair in commits.windows(2) {
let (ca, cb) = (pair[0], pair[1]);
let (ta, tb) = (
tree_iter_by_commit(&ca, &mut buf, &mut find),
tree_iter_by_commit(&cb, &mut buf2, &mut find),
tree_iter_by_commit_res(&ca, &mut buf, &mut find),
tree_iter_by_commit_res(&cb, &mut buf2, &mut find),
);
let mut count = Count::default();
ta.changes_needed(tb, &mut state, |id, buf| find_tree_iter(id, buf, &mut find), &mut count)?;
diff::tree::Changes::from(ta).needed_to_obtain(
tb,
&mut state,
|id, buf| find_tree_iter_res(id, buf, &mut find),
&mut count,
)?;
changes += count.0;
}
changes
}
};

fn find_tree_iter<'b, L>(id: &oid, buf: &'b mut Vec<u8>, mut find: L) -> Option<TreeRefIter<'b>>
fn find_tree_iter_res<'b, L, E>(id: &oid, buf: &'b mut Vec<u8>, mut find: L) -> Result<TreeRefIter<'b>, E>
where
L: for<'a> FnMut(&oid, &'a mut Vec<u8>) -> Option<git_repository::objs::Data<'a>>,
L: for<'a> FnMut(&oid, &'a mut Vec<u8>) -> Result<git_repository::objs::Data<'a>, E>,
E: std::error::Error + Send + Sync + 'static,
{
find(id, buf).and_then(|o| o.try_into_tree_iter())
find(id, buf).map(|o| o.try_into_tree_iter().expect("trees only"))
}

fn tree_iter_by_commit<'b, L>(id: &oid, buf: &'b mut Vec<u8>, mut find: L) -> TreeRefIter<'b>
fn tree_iter_by_commit_res<'b, L, E>(id: &oid, buf: &'b mut Vec<u8>, mut find: L) -> TreeRefIter<'b>
where
L: for<'a> FnMut(&oid, &'a mut Vec<u8>) -> Option<git_repository::objs::Data<'a>>,
L: for<'a> FnMut(&oid, &'a mut Vec<u8>) -> Result<git_repository::objs::Data<'a>, E>,
E: std::error::Error + Send + Sync + 'static,
{
let tid = find(id, buf)
.expect("commit present")
.try_into_commit_iter()
.expect("a commit")
.tree_id()
.expect("tree id present and decodable");
find_tree_iter(&tid, buf, find).expect("tree available")
find_tree_iter_res(&tid, buf, find).expect("tree available")
}

#[derive(Default)]
Expand Down

0 comments on commit cef0b51

Please sign in to comment.