Skip to content

Commit cef0b51

Browse files
committed
Merge branch 'main' into filter-refs-by-spec
2 parents 569b7bc + 85a3bed commit cef0b51

File tree

79 files changed

+1135
-318
lines changed

Some content is hidden

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

79 files changed

+1135
-318
lines changed

Cargo.lock

+22-22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repository = "https://github.com/Byron/gitoxide"
55
authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"]
66
edition = "2018"
77
license = "MIT OR Apache-2.0"
8-
version = "0.15.0"
8+
version = "0.16.0"
99
default-run = "gix"
1010
include = ["src/**/*", "LICENSE-*", "README.md", "CHANGELOG.md"]
1111
resolver = "2"
@@ -79,11 +79,11 @@ cache-efficiency-debug = ["git-features/cache-efficiency-debug"]
7979
[dependencies]
8080
anyhow = "1.0.42"
8181

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

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

8888
clap = { version = "3.2.5", features = ["derive", "cargo"] }
8989
prodash = { version = "19.0.0", optional = true, default-features = false }

Makefile

+1-3
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,10 @@ check: ## Build all code in suitable configurations
119119
&& cargo check --features blocking-client \
120120
&& cargo check --features async-client
121121
cd git-protocol && if cargo check --all-features 2>/dev/null; then false; else true; fi
122-
cd git-repository && cargo check --no-default-features --features local \
123-
&& cargo check --no-default-features --features async-network-client \
122+
cd git-repository && cargo check --no-default-features --features async-network-client \
124123
&& cargo check --no-default-features --features async-network-client-async-std \
125124
&& cargo check --no-default-features --features blocking-network-client \
126125
&& cargo check --no-default-features --features blocking-network-client,blocking-http-transport \
127-
&& cargo check --no-default-features --features one-stop-shop \
128126
&& cargo check --no-default-features --features max-performance \
129127
&& cargo check --no-default-features --features max-performance-safe \
130128
&& cargo check --no-default-features

cargo-smart-release/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cargo-smart-release"
3-
version = "0.11.0"
3+
version = "0.12.0"
44
authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"]
55
repository = "https://github.com/Byron/gitoxide"
66
description = "Cargo subcommand for fearlessly releasing crates in workspaces."
@@ -24,7 +24,7 @@ test = false
2424
cache-efficiency-debug = ["git-repository/cache-efficiency-debug"]
2525

2626
[dependencies]
27-
git-repository = { version = "^0.22.1", path = "../git-repository", default-features = false, features = ["unstable", "max-performance-safe"] }
27+
git-repository = { version = "^0.23.0", path = "../git-repository", default-features = false, features = ["unstable", "max-performance-safe"] }
2828
anyhow = "1.0.42"
2929
clap = { version = "3.2.5", features = ["derive", "cargo"] }
3030
env_logger = { version = "0.9.0", default-features = false, features = ["humantime", "termcolor", "atty"] }

etc/check-package-size.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ echo "in root: gitoxide CLI"
2929
(enter git-bitmap && indent cargo diet -n --package-size-limit 5KB)
3030
(enter git-tempfile && indent cargo diet -n --package-size-limit 30KB)
3131
(enter git-lock && indent cargo diet -n --package-size-limit 20KB)
32-
(enter git-config && indent cargo diet -n --package-size-limit 110KB)
32+
(enter git-config && indent cargo diet -n --package-size-limit 120KB)
3333
(enter git-command && indent cargo diet -n --package-size-limit 5KB)
3434
(enter git-hash && indent cargo diet -n --package-size-limit 20KB)
3535
(enter git-chunk && indent cargo diet -n --package-size-limit 10KB)
@@ -39,7 +39,7 @@ echo "in root: gitoxide CLI"
3939
(enter git-ref && indent cargo diet -n --package-size-limit 50KB)
4040
(enter git-diff && indent cargo diet -n --package-size-limit 10KB)
4141
(enter git-traverse && indent cargo diet -n --package-size-limit 10KB)
42-
(enter git-url && indent cargo diet -n --package-size-limit 15KB)
42+
(enter git-url && indent cargo diet -n --package-size-limit 20KB)
4343
(enter git-validate && indent cargo diet -n --package-size-limit 5KB)
4444
(enter git-date && indent cargo diet -n --package-size-limit 10KB)
4545
(enter git-filter && indent cargo diet -n --package-size-limit 5KB)

experiments/diffing/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ publish = false
99

1010
[dependencies]
1111
anyhow = "1"
12-
git-repository = { version = "^0.22.1", path = "../../git-repository", features = ["unstable"] }
13-
git-features-for-config = { package = "git-features", version = "^0.22.2", path = "../../git-features", features = ["cache-efficiency-debug"] }
12+
git-repository = { version = "^0.23.0", path = "../../git-repository", features = ["unstable"] }
13+
git-features-for-config = { package = "git-features", version = "^0.22.3", path = "../../git-features", features = ["cache-efficiency-debug"] }
1414
git2 = "0.14"
1515
rayon = "1.5.0"

experiments/diffing/src/main.rs

+30-17
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fn main() -> anyhow::Result<()> {
6161
.to_cache()
6262
.with_pack_cache(|| Box::new(odb::pack::cache::lru::MemoryCappedHashmap::new(cache_size())))
6363
.with_object_cache(|| Box::new(odb::pack::cache::object::MemoryCappedHashmap::new(cache_size())));
64-
move |oid, buf: &mut Vec<u8>| handle.find(oid, buf).ok()
64+
move |oid, buf: &mut Vec<u8>| handle.find(oid, buf)
6565
},
6666
Computation::MultiThreaded,
6767
)?;
@@ -84,7 +84,7 @@ fn main() -> anyhow::Result<()> {
8484
let handle = db
8585
.to_cache()
8686
.with_object_cache(|| Box::new(odb::pack::cache::object::MemoryCappedHashmap::new(cache_size())));
87-
move |oid, buf: &mut Vec<u8>| handle.find(oid, buf).ok()
87+
move |oid, buf: &mut Vec<u8>| handle.find(oid, buf)
8888
},
8989
Computation::MultiThreaded,
9090
)?;
@@ -106,7 +106,7 @@ fn main() -> anyhow::Result<()> {
106106
let handle = db
107107
.to_cache()
108108
.with_object_cache(|| Box::new(odb::pack::cache::object::MemoryCappedHashmap::new(cache_size())));
109-
move |oid, buf: &mut Vec<u8>| handle.find(oid, buf).ok()
109+
move |oid, buf: &mut Vec<u8>| handle.find(oid, buf)
110110
},
111111
Computation::SingleThreaded,
112112
)?;
@@ -185,10 +185,11 @@ fn do_libgit2_treediff(commits: &[ObjectId], repo_dir: &std::path::Path, mode: C
185185
})
186186
}
187187

188-
fn do_gitoxide_tree_diff<C, L>(commits: &[ObjectId], make_find: C, mode: Computation) -> anyhow::Result<usize>
188+
fn do_gitoxide_tree_diff<C, L, E>(commits: &[ObjectId], make_find: C, mode: Computation) -> anyhow::Result<usize>
189189
where
190190
C: Fn() -> L + Sync,
191-
L: for<'b> FnMut(&oid, &'b mut Vec<u8>) -> Option<git_repository::objs::Data<'b>>,
191+
L: for<'b> FnMut(&oid, &'b mut Vec<u8>) -> Result<git_repository::objs::Data<'b>, E>,
192+
E: std::error::Error + Send + Sync + 'static,
192193
{
193194
let changes: usize = match mode {
194195
Computation::MultiThreaded => {
@@ -205,11 +206,16 @@ where
205206
|(state, buf1, buf2, find), pair| {
206207
let (ca, cb) = (pair[0], pair[1]);
207208
let (ta, tb) = (
208-
tree_iter_by_commit(&ca, buf1, &mut *find),
209-
tree_iter_by_commit(&cb, buf2, &mut *find),
209+
tree_iter_by_commit_res(&ca, buf1, &mut *find),
210+
tree_iter_by_commit_res(&cb, buf2, &mut *find),
210211
);
211212
let mut count = Count::default();
212-
ta.changes_needed(tb, state, |id, buf| find_tree_iter(id, buf, &mut *find), &mut count)?;
213+
diff::tree::Changes::from(ta).needed_to_obtain(
214+
tb,
215+
state,
216+
|id, buf| find_tree_iter_res(id, buf, &mut *find),
217+
&mut count,
218+
)?;
213219
changes.fetch_add(count.0, std::sync::atomic::Ordering::Relaxed);
214220
Ok(())
215221
},
@@ -226,35 +232,42 @@ where
226232
for pair in commits.windows(2) {
227233
let (ca, cb) = (pair[0], pair[1]);
228234
let (ta, tb) = (
229-
tree_iter_by_commit(&ca, &mut buf, &mut find),
230-
tree_iter_by_commit(&cb, &mut buf2, &mut find),
235+
tree_iter_by_commit_res(&ca, &mut buf, &mut find),
236+
tree_iter_by_commit_res(&cb, &mut buf2, &mut find),
231237
);
232238
let mut count = Count::default();
233-
ta.changes_needed(tb, &mut state, |id, buf| find_tree_iter(id, buf, &mut find), &mut count)?;
239+
diff::tree::Changes::from(ta).needed_to_obtain(
240+
tb,
241+
&mut state,
242+
|id, buf| find_tree_iter_res(id, buf, &mut find),
243+
&mut count,
244+
)?;
234245
changes += count.0;
235246
}
236247
changes
237248
}
238249
};
239250

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

247-
fn tree_iter_by_commit<'b, L>(id: &oid, buf: &'b mut Vec<u8>, mut find: L) -> TreeRefIter<'b>
259+
fn tree_iter_by_commit_res<'b, L, E>(id: &oid, buf: &'b mut Vec<u8>, mut find: L) -> TreeRefIter<'b>
248260
where
249-
L: for<'a> FnMut(&oid, &'a mut Vec<u8>) -> Option<git_repository::objs::Data<'a>>,
261+
L: for<'a> FnMut(&oid, &'a mut Vec<u8>) -> Result<git_repository::objs::Data<'a>, E>,
262+
E: std::error::Error + Send + Sync + 'static,
250263
{
251264
let tid = find(id, buf)
252265
.expect("commit present")
253266
.try_into_commit_iter()
254267
.expect("a commit")
255268
.tree_id()
256269
.expect("tree id present and decodable");
257-
find_tree_iter(&tid, buf, find).expect("tree available")
270+
find_tree_iter_res(&tid, buf, find).expect("tree available")
258271
}
259272

260273
#[derive(Default)]

0 commit comments

Comments
 (0)