Skip to content

Commit

Permalink
adjust to changes in gix-features
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed May 15, 2023
1 parent 3db18c4 commit c48bbe3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 28 deletions.
53 changes: 26 additions & 27 deletions gitoxide-core/src/pack/explode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ enum Error {
}

#[allow(clippy::large_enum_variant)]
#[derive(Clone)]
enum OutputWriter {
Loose(loose::Store),
Sink(odb::Sink),
Expand Down Expand Up @@ -185,36 +186,34 @@ pub fn pack_or_pack_index(
&should_interrupt,
{
let object_path = object_path.map(|p| p.as_ref().to_owned());
move || {
let out = OutputWriter::new(object_path.clone(), sink_compress, object_hash);
let loose_odb = verify.then(|| object_path.as_ref().map(|path| loose::Store::at(path, object_hash))).flatten();
let mut read_buf = Vec::new();
move |object_kind, buf, index_entry, progress| {
let written_id = out.write_buf(object_kind, buf).map_err(|err| {
Error::Write{source: Box::new(err) as Box<dyn std::error::Error + Send + Sync>,
kind: object_kind,
id: index_entry.oid,
}
})?;
if written_id != index_entry.oid {
if let object::Kind::Tree = object_kind {
progress.info(format!(
"The tree in pack named {} was written as {} due to modes 100664 and 100640 rewritten as 100644.",
index_entry.oid, written_id
));
} else {
return Err(Error::ObjectEncodeMismatch{kind: object_kind, actual: index_entry.oid, expected:written_id});
}
let out = OutputWriter::new(object_path.clone(), sink_compress, object_hash);
let loose_odb = verify.then(|| object_path.as_ref().map(|path| loose::Store::at(path, object_hash))).flatten();
let mut read_buf = Vec::new();
move |object_kind, buf, index_entry, progress| {
let written_id = out.write_buf(object_kind, buf).map_err(|err| {
Error::Write{source: Box::new(err) as Box<dyn std::error::Error + Send + Sync>,
kind: object_kind,
id: index_entry.oid,
}
if let Some(verifier) = loose_odb.as_ref() {
let obj = verifier
.try_find(written_id, &mut read_buf)
.map_err(|err| Error::WrittenFileCorrupt{source:err, id:written_id})?
.ok_or(Error::WrittenFileMissing{id:written_id})?;
obj.verify_checksum(written_id)?;
})?;
if written_id != index_entry.oid {
if let object::Kind::Tree = object_kind {
progress.info(format!(
"The tree in pack named {} was written as {} due to modes 100664 and 100640 rewritten as 100644.",
index_entry.oid, written_id
));
} else {
return Err(Error::ObjectEncodeMismatch{kind: object_kind, actual: index_entry.oid, expected:written_id});
}
Ok(())
}
if let Some(verifier) = loose_odb.as_ref() {
let obj = verifier
.try_find(written_id, &mut read_buf)
.map_err(|err| Error::WrittenFileCorrupt{source:err, id:written_id})?
.ok_or(Error::WrittenFileMissing{id:written_id})?;
obj.verify_checksum(written_id)?;
}
Ok(())
}
},
pack::index::traverse::Options {
Expand Down
2 changes: 1 addition & 1 deletion gix-pack/src/cache/delta/traverse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ where
}
},
{
move |node, state| {
move |node, state, _threads_left, should_interrupt| {
resolve::deltas(
object_counter.clone(),
size_counter.clone(),
Expand Down

0 comments on commit c48bbe3

Please sign in to comment.