Skip to content

Commit 2f275d5

Browse files
committed
Merge branch 'fix-851'
2 parents 4f879bf + 215889c commit 2f275d5

File tree

37 files changed

+782
-368
lines changed

37 files changed

+782
-368
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,10 @@ gix = { version = "^0.44.1", path = "gix", default-features = false }
157157
time = "0.3.19"
158158

159159
clap = { version = "4.1.1", features = ["derive", "cargo"] }
160-
prodash = { version = "23.1", optional = true, default-features = false }
160+
prodash = { version = "25.0.0", optional = true, default-features = false }
161161
is-terminal = { version = "0.4.0", optional = true }
162162
env_logger = { version = "0.10.0", default-features = false }
163-
crosstermion = { version = "0.10.1", optional = true, default-features = false }
163+
crosstermion = { version = "0.11.0", optional = true, default-features = false }
164164
futures-lite = { version = "1.12.0", optional = true, default-features = false, features = ["std"] }
165165

166166
# for progress

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ unit-tests: ## run all unit tests
151151
cd gix-ref/tests && cargo test --all-features
152152
cd gix-odb && cargo test && cargo test --all-features
153153
cd gix-object && cargo test && cargo test --features verbose-object-parsing-errors
154+
cd gix-pack && cargo test --all-features
154155
cd gix-pack/tests && cargo test --features internal-testing-to-avoid-being-run-by-cargo-test-all \
155156
&& cargo test --features "internal-testing-gix-features-parallel"
156157
cd gix-index/tests && cargo test --features internal-testing-to-avoid-being-run-by-cargo-test-all \

gitoxide-core/src/hours/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,10 +344,10 @@ where
344344
}
345345
None => Vec::new(),
346346
};
347-
if let Some(mut progress) = change_progress {
347+
if let Some(progress) = change_progress {
348348
progress.show_throughput(start);
349349
}
350-
if let Some(mut progress) = lines_progress {
350+
if let Some(progress) = lines_progress {
351351
progress.show_throughput(start);
352352
}
353353

gitoxide-core/src/organize.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,12 @@ pub enum Mode {
1212
Simulate,
1313
}
1414

15-
fn find_git_repository_workdirs<P: Progress>(
15+
fn find_git_repository_workdirs(
1616
root: impl AsRef<Path>,
17-
mut progress: P,
17+
mut progress: impl Progress,
1818
debug: bool,
1919
threads: Option<usize>,
20-
) -> impl Iterator<Item = (PathBuf, gix::Kind)>
21-
where
22-
P::SubProgress: Sync,
23-
{
20+
) -> impl Iterator<Item = (PathBuf, gix::Kind)> {
2421
progress.init(None, progress::count("filesystem items"));
2522
fn is_repository(path: &Path) -> Option<gix::Kind> {
2623
// Can be git dir or worktree checkout (file)
@@ -211,10 +208,7 @@ pub fn discover<P: Progress>(
211208
mut progress: P,
212209
debug: bool,
213210
threads: Option<usize>,
214-
) -> anyhow::Result<()>
215-
where
216-
<P::SubProgress as Progress>::SubProgress: Sync,
217-
{
211+
) -> anyhow::Result<()> {
218212
for (git_workdir, _kind) in
219213
find_git_repository_workdirs(source_dir, progress.add_child("Searching repositories"), debug, threads)
220214
{
@@ -229,10 +223,7 @@ pub fn run<P: Progress>(
229223
destination: impl AsRef<Path>,
230224
mut progress: P,
231225
threads: Option<usize>,
232-
) -> anyhow::Result<()>
233-
where
234-
<P::SubProgress as Progress>::SubProgress: Sync,
235-
{
226+
) -> anyhow::Result<()> {
236227
let mut num_errors = 0usize;
237228
let destination = destination.as_ref().canonicalize()?;
238229
for (path_to_move, kind) in

gitoxide-core/src/pack/explode.rs

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ enum Error {
9090
}
9191

9292
#[allow(clippy::large_enum_variant)]
93+
#[derive(Clone)]
9394
enum OutputWriter {
9495
Loose(loose::Store),
9596
Sink(odb::Sink),
@@ -177,51 +178,57 @@ pub fn pack_or_pack_index(
177178
}
178179
});
179180

180-
let pack::index::traverse::Outcome{mut progress, ..} = bundle
181+
let pack::index::traverse::Outcome { progress, .. } = bundle
181182
.index
182183
.traverse(
183184
&bundle.pack,
184185
progress,
185186
&should_interrupt,
186187
{
187188
let object_path = object_path.map(|p| p.as_ref().to_owned());
188-
move || {
189-
let out = OutputWriter::new(object_path.clone(), sink_compress, object_hash);
190-
let loose_odb = verify.then(|| object_path.as_ref().map(|path| loose::Store::at(path, object_hash))).flatten();
191-
let mut read_buf = Vec::new();
192-
move |object_kind, buf, index_entry, progress| {
193-
let written_id = out.write_buf(object_kind, buf).map_err(|err| {
194-
Error::Write{source: Box::new(err) as Box<dyn std::error::Error + Send + Sync>,
189+
let out = OutputWriter::new(object_path.clone(), sink_compress, object_hash);
190+
let loose_odb = verify
191+
.then(|| object_path.as_ref().map(|path| loose::Store::at(path, object_hash)))
192+
.flatten();
193+
let mut read_buf = Vec::new();
194+
move |object_kind, buf, index_entry, progress| {
195+
let written_id = out.write_buf(object_kind, buf).map_err(|err| Error::Write {
196+
source: Box::new(err) as Box<dyn std::error::Error + Send + Sync>,
197+
kind: object_kind,
198+
id: index_entry.oid,
199+
})?;
200+
if written_id != index_entry.oid {
201+
if let object::Kind::Tree = object_kind {
202+
progress.info(format!(
203+
"The tree in pack named {} was written as {} due to modes 100664 and 100640 rewritten as 100644.",
204+
index_entry.oid, written_id
205+
));
206+
} else {
207+
return Err(Error::ObjectEncodeMismatch {
195208
kind: object_kind,
196-
id: index_entry.oid,
197-
}
198-
})?;
199-
if written_id != index_entry.oid {
200-
if let object::Kind::Tree = object_kind {
201-
progress.info(format!(
202-
"The tree in pack named {} was written as {} due to modes 100664 and 100640 rewritten as 100644.",
203-
index_entry.oid, written_id
204-
));
205-
} else {
206-
return Err(Error::ObjectEncodeMismatch{kind: object_kind, actual: index_entry.oid, expected:written_id});
207-
}
209+
actual: index_entry.oid,
210+
expected: written_id,
211+
});
208212
}
209-
if let Some(verifier) = loose_odb.as_ref() {
210-
let obj = verifier
211-
.try_find(written_id, &mut read_buf)
212-
.map_err(|err| Error::WrittenFileCorrupt{source:err, id:written_id})?
213-
.ok_or(Error::WrittenFileMissing{id:written_id})?;
214-
obj.verify_checksum(written_id)?;
215-
}
216-
Ok(())
217213
}
214+
if let Some(verifier) = loose_odb.as_ref() {
215+
let obj = verifier
216+
.try_find(written_id, &mut read_buf)
217+
.map_err(|err| Error::WrittenFileCorrupt {
218+
source: err,
219+
id: written_id,
220+
})?
221+
.ok_or(Error::WrittenFileMissing { id: written_id })?;
222+
obj.verify_checksum(written_id)?;
223+
}
224+
Ok(())
218225
}
219226
},
220227
pack::index::traverse::Options {
221228
traversal: algorithm,
222229
thread_limit,
223230
check: check.into(),
224-
make_pack_lookup_cache: pack::cache::lru::StaticLinkedList::<64>::default,
231+
make_pack_lookup_cache: pack::cache::lru::StaticLinkedList::<64>::default,
225232
},
226233
)
227234
.with_context(|| "Failed to explode the entire pack - some loose objects may have been created nonetheless")?;

gitoxide-core/src/query/engine/update.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ pub fn update(
4646
};
4747
let commit_counter = db_progress.counter().expect("shared counter available");
4848

49-
let mut change_progress = {
49+
let change_progress = {
5050
let mut p = progress.add_child("find changes");
5151
p.init(None, progress::count("modified files"));
5252
p
5353
};
5454
let change_counter = change_progress.counter().expect("shared counter available");
5555

56-
let mut lines_progress = {
56+
let lines_progress = {
5757
let mut p = progress.add_child("find changes");
5858
p.init(None, progress::count("diff lines"));
5959
p

gitoxide-core/src/repository/verify.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub fn integrity(
3131
}: Context,
3232
) -> anyhow::Result<()> {
3333
#[cfg_attr(not(feature = "serde"), allow(unused))]
34-
let mut outcome = repo.objects.store_ref().verify_integrity(
34+
let outcome = repo.objects.store_ref().verify_integrity(
3535
progress,
3636
should_interrupt,
3737
gix::odb::pack::index::verify::integrity::Options {

gix-features/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repository = "https://github.com/Byron/gitoxide"
55
version = "0.29.0"
66
authors = ["Sebastian Thiel <[email protected]>"]
77
license = "MIT/Apache-2.0"
8-
edition = "2018"
8+
edition = "2021"
99
rust-version = "1.64"
1010

1111
[lib]
@@ -123,7 +123,7 @@ crc32fast = { version = "1.2.1", optional = true }
123123
sha1 = { version = "0.10.0", optional = true }
124124

125125
# progress
126-
prodash = { version = "23.1", optional = true, default-features = false }
126+
prodash = { version = "25.0.0", optional = true, default-features = false }
127127
bytesize = { version = "1.0.1", optional = true }
128128

129129
# pipe

0 commit comments

Comments
 (0)