Skip to content

Commit a69b45c

Browse files
committed
adapt to changes in gix_object and gix_odb.
1 parent 7c665bf commit a69b45c

File tree

33 files changed

+50
-46
lines changed

33 files changed

+50
-46
lines changed

gitoxide-core/src/index/checkout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::{
44
};
55

66
use anyhow::bail;
7-
use gix::{odb::FindExt, worktree::state::checkout, NestedProgress, Progress};
7+
use gix::{prelude::FindExt, worktree::state::checkout, NestedProgress, Progress};
88

99
use crate::{
1010
index,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use gix::{
99
bstr::{BStr, BString, ByteSlice},
1010
features::progress,
1111
object::tree::diff::rewrites::CopySource,
12-
odb::FindExt,
1312
parallel::{InOrderIter, SequenceId},
13+
prelude::FindExt,
1414
prelude::ObjectIdExt,
1515
Count, Progress,
1616
};

gitoxide-core/src/repository/verify.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub fn integrity(
4444
index.verify_integrity()?;
4545
index.verify_entries()?;
4646
index.verify_extensions(true, {
47-
use gix::odb::FindExt;
47+
use gix::prelude::FindExt;
4848
let objects = repo.objects;
4949
move |oid, buf: &mut Vec<u8>| objects.find_tree_iter(oid, buf).ok()
5050
})?;

gix-archive/tests/archive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ mod from_tree {
99
use gix_archive::Format;
1010
use gix_attributes::glob::pattern::Case;
1111
use gix_object::tree::EntryMode;
12-
use gix_odb::FindExt;
12+
use gix_object::FindExt;
1313
use gix_testtools::bstr::ByteSlice;
1414
use gix_worktree::stack::state::attributes::Source;
1515

gix-diff/tests/tree/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,14 @@ mod changes {
142142

143143
let head = head_of(db);
144144
commit::Ancestors::new(Some(head), commit::ancestors::State::default(), |oid, buf| {
145-
use gix_odb::FindExt;
145+
use gix_object::FindExt;
146146
db.find_commit_iter(oid, buf)
147147
})
148148
.collect::<Result<Vec<_>, _>>()
149149
.expect("valid iteration")
150150
.into_iter()
151151
.map(|c| {
152-
use gix_odb::FindExt;
152+
use gix_object::FindExt;
153153
(
154154
db.find_commit(&c.id, &mut buf)
155155
.unwrap()

gix-negotiate/tests/baseline/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::cell::RefCell;
22

33
use gix_negotiate::Algorithm;
44
use gix_object::{bstr, bstr::ByteSlice};
5-
use gix_odb::{Find, FindExt};
5+
use gix_object::{Find, FindExt};
66
use gix_ref::{file::ReferenceExt, store::WriteReflog};
77

88
#[test]

gix-ref/tests/file/transaction/prepare_and_commit/create_or_update/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::convert::TryInto;
33
use gix_hash::ObjectId;
44
use gix_lock::acquire::Fail;
55
use gix_object::bstr::{BString, ByteSlice};
6-
use gix_odb::Find;
6+
use gix_object::Find;
77
use gix_ref::{
88
file::{
99
transaction::{self, PackedRefs},

gix-ref/tests/file/worktree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{cmp::Ordering, path::PathBuf};
22

3-
use gix_odb::Find;
3+
use gix_object::Find;
44
use gix_ref::{file::ReferenceExt, Reference};
55
use gix_testtools::Creation;
66

gix-revision/tests/describe/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::{borrow::Cow, path::PathBuf};
22

33
use gix_object::bstr::ByteSlice;
4-
use gix_odb::Find;
4+
use gix_object::Find;
55
use gix_revision::{
66
describe,
77
describe::{Error, Outcome},

gix-traverse/tests/commit/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ mod ancestor {
346346

347347
/// Some dates adjusted to be a year apart, but still 'c1' and 'c2' with the same date.
348348
mod adjusted_dates {
349-
use gix_odb::FindExt;
349+
use gix_object::FindExt;
350350
use gix_traverse::commit::{ancestors, Ancestors, Parents, Sorting};
351351

352352
use crate::{commit::ancestor::TraversalAssertion, hex_to_id};

gix-worktree-state/tests/state/checkout.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::{
99

1010
use gix_features::progress;
1111
use gix_object::bstr::ByteSlice;
12-
use gix_odb::FindExt;
12+
use gix_object::FindExt;
1313
use gix_testtools::tempfile::TempDir;
1414
use gix_worktree_state::checkout::Collision;
1515
use once_cell::sync::Lazy;
@@ -504,7 +504,7 @@ fn checkout_index_in_tmp_dir_opts(
504504
if allow_return_object(oid) {
505505
odb.find_blob(oid, buf)
506506
} else {
507-
Err(gix_odb::find::existing_object::Error::NotFound { oid: oid.to_owned() })
507+
Err(gix_object::find::existing_object::Error::NotFound { oid: oid.to_owned() })
508508
}
509509
},
510510
&progress::Discard,

gix-worktree-stream/tests/stream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ mod from_tree {
1212
};
1313

1414
use gix_attributes::glob::pattern::Case;
15+
use gix_object::FindExt;
1516
use gix_object::{bstr::ByteSlice, tree::EntryMode};
16-
use gix_odb::FindExt;
1717
use gix_testtools::once_cell::sync::Lazy;
1818
use gix_worktree::stack::state::attributes::Source;
1919

gix-worktree/tests/worktree/stack/ignore.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use bstr::{BStr, ByteSlice};
2-
use gix_odb::FindExt;
2+
use gix_object::FindExt;
33
use gix_worktree::{stack::state::ignore::Source, Stack};
44

55
use crate::hex_to_id;

gix/src/attribute_stack.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::bstr::BStr;
22
use crate::types::AttributeStack;
33
use crate::Repository;
4-
use gix_odb::FindExt;
4+
use gix_object::FindExt;
55
use std::ops::{Deref, DerefMut};
66

77
/// Lifecycle

gix/src/clone/checkout.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::{clone::PrepareCheckout, Repository};
44
pub mod main_worktree {
55
use std::{path::PathBuf, sync::atomic::AtomicBool};
66

7-
use gix_odb::FindExt;
7+
use gix_object::FindExt;
88

99
use crate::{clone::PrepareCheckout, Progress, Repository};
1010

@@ -26,7 +26,7 @@ pub mod main_worktree {
2626
#[error(transparent)]
2727
CheckoutOptions(#[from] crate::config::checkout_options::Error),
2828
#[error(transparent)]
29-
IndexCheckout(#[from] gix_worktree_state::checkout::Error<gix_odb::find::existing_object::Error>),
29+
IndexCheckout(#[from] gix_worktree_state::checkout::Error<gix_object::find::existing_object::Error>),
3030
#[error("Failed to reopen object database as Arc (only if thread-safety wasn't compiled in)")]
3131
OpenArcOdb(#[from] std::io::Error),
3232
#[error("The HEAD reference could not be located")]

gix/src/clone/fetch/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{borrow::Cow, convert::TryInto, io::Write};
22

3-
use gix_odb::Find;
3+
use gix_object::Find;
44
use gix_ref::{
55
transaction::{LogChange, RefLog},
66
FullNameRef,

gix/src/commit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub mod describe {
2828

2929
use gix_hash::ObjectId;
3030
use gix_hashtable::HashMap;
31-
use gix_odb::Find;
31+
use gix_object::Find;
3232

3333
use crate::{bstr::BStr, ext::ObjectIdExt, Repository};
3434

gix/src/filter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use std::borrow::Cow;
33

44
pub use gix_filter as plumbing;
5-
use gix_odb::{Find, FindExt};
5+
use gix_object::{Find, FindExt};
66

77
use crate::{
88
bstr::BStr,
@@ -150,7 +150,7 @@ impl<'repo> Pipeline<'repo> {
150150
&mut |_, attrs| {
151151
entry.matching_attributes(attrs);
152152
},
153-
&mut |buf| -> Result<_, gix_odb::find::Error> {
153+
&mut |buf| -> Result<_, gix_object::find::Error> {
154154
let entry = match index.entry_by_path(gix_path::into_bstr(rela_path).as_ref()) {
155155
None => return Ok(None),
156156
Some(entry) => entry,

gix/src/object/errors.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ pub mod find {
2020
/// Indicate that an error occurred when trying to find an object.
2121
#[derive(Debug, thiserror::Error)]
2222
#[error(transparent)]
23-
pub struct Error(#[from] pub gix_odb::find::Error);
23+
pub struct Error(#[from] pub gix_object::find::Error);
2424

2525
///
2626
pub mod existing {
2727
/// An object could not be found in the database, or an error occurred when trying to obtain it.
28-
pub type Error = gix_odb::find::existing::Error;
28+
pub type Error = gix_object::find::existing::Error;
2929
}
3030
}
3131

@@ -34,5 +34,5 @@ pub mod write {
3434
/// An error to indicate writing to the loose object store failed.
3535
#[derive(Debug, thiserror::Error)]
3636
#[error(transparent)]
37-
pub struct Error(#[from] pub gix_odb::find::Error);
37+
pub struct Error(#[from] pub gix_object::find::Error);
3838
}

gix/src/object/tree/diff/for_each.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
use gix_object::FindExt;
12
use gix_object::TreeRefIter;
2-
use gix_odb::FindExt;
33

44
use super::{change, Action, Change, Platform};
55
use crate::{

gix/src/object/tree/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use gix_hash::ObjectId;
22
use gix_macros::momo;
33
pub use gix_object::tree::EntryMode;
4+
use gix_object::FindExt;
45
use gix_object::{bstr::BStr, TreeRefIter};
5-
use gix_odb::FindExt;
66

77
use crate::{object::find, Id, ObjectDetached, Tree};
88

gix/src/object/tree/traverse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use gix_odb::FindExt;
1+
use gix_object::FindExt;
22

33
use crate::Tree;
44

gix/src/pathspec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Pathspec plumbing and abstractions
22
use gix_macros::momo;
3-
use gix_odb::FindExt;
3+
use gix_object::FindExt;
44
pub use gix_pathspec::*;
55

66
use crate::{bstr::BStr, AttributeStack, Pathspec, PathspecDetached, Repository};

gix/src/prelude.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
pub use gix_features::parallel::reduce::Finalize;
2-
pub use gix_odb::{Find, FindExt, Header, HeaderExt, Write};
2+
pub use gix_object::{Find, FindExt};
3+
pub use gix_odb::{Header, HeaderExt, Write};
34

45
pub use crate::ext::*;

gix/src/remote/connection/fetch/receive_pack.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ use std::{
33
sync::atomic::{AtomicBool, Ordering},
44
};
55

6-
use gix_odb::{store::RefreshMode, FindExt};
6+
use gix_object::FindExt;
7+
use gix_odb::store::RefreshMode;
78
use gix_protocol::{
89
fetch::Arguments,
910
transport::{client::Transport, packetline::read::ProgressAction},

gix/src/remote/connection/fetch/update_refs/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![allow(clippy::result_large_err)]
22
use std::{collections::BTreeMap, convert::TryInto, path::PathBuf};
33

4-
use gix_odb::{Find, FindExt};
4+
use gix_object::{Exists, Find, FindExt};
55
use gix_ref::{
66
transaction::{Change, LogChange, PreviousValue, RefEdit, RefLog},
77
Target, TargetRef,
@@ -96,8 +96,8 @@ pub(crate) fn update(
9696
) {
9797
// `None` only if unborn.
9898
let remote_id = remote.as_id();
99-
if matches!(dry_run, fetch::DryRun::No) && !remote_id.map_or(true, |id| repo.objects.contains(id)) {
100-
if let Some(remote_id) = remote_id.filter(|id| !repo.objects.contains(id)) {
99+
if matches!(dry_run, fetch::DryRun::No) && !remote_id.map_or(true, |id| repo.objects.exists(id)) {
100+
if let Some(remote_id) = remote_id.filter(|id| !repo.objects.exists(id)) {
101101
let update = if is_implicit_tag {
102102
Mode::ImplicitTagNotSentByRemote.into()
103103
} else {

gix/src/repository/graph.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use gix_odb::Find;
1+
use gix_object::Find;
22

33
impl crate::Repository {
44
/// Create a graph data-structure capable of accelerating graph traversals and storing state of type `T` with each commit

gix/src/repository/index.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use gix_odb::FindExt;
1+
use gix_object::FindExt;
22

33
use crate::{config::cache::util::ApplyLeniencyDefault, repository::IndexPersistedOrInMemory, worktree};
44

gix/src/repository/object.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ use std::{convert::TryInto, ops::DerefMut};
33

44
use gix_hash::ObjectId;
55
use gix_macros::momo;
6-
use gix_odb::{Find, FindExt, Header, HeaderExt, Write};
6+
use gix_object::{Exists, Find, FindExt};
7+
use gix_odb::{Header, HeaderExt, Write};
78
use gix_ref::{
89
transaction::{LogChange, PreviousValue, RefLog},
910
FullName,
@@ -70,7 +71,7 @@ impl crate::Repository {
7071
if id == ObjectId::empty_tree(self.object_hash()) {
7172
true
7273
} else {
73-
self.objects.contains(id)
74+
self.objects.exists(id)
7475
}
7576
}
7677

@@ -140,7 +141,7 @@ impl crate::Repository {
140141

141142
fn write_object_inner(&self, buf: &[u8], kind: gix_object::Kind) -> Result<Id<'_>, object::write::Error> {
142143
let oid = gix_object::compute_hash(self.object_hash(), kind, buf);
143-
if self.objects.contains(&oid) {
144+
if self.objects.exists(&oid) {
144145
return Ok(oid.attach(self));
145146
}
146147

@@ -158,7 +159,7 @@ impl crate::Repository {
158159
pub fn write_blob(&self, bytes: impl AsRef<[u8]>) -> Result<Id<'_>, object::write::Error> {
159160
let bytes = bytes.as_ref();
160161
let oid = gix_object::compute_hash(self.object_hash(), gix_object::Kind::Blob, bytes);
161-
if self.objects.contains(&oid) {
162+
if self.objects.exists(&oid) {
162163
return Ok(oid.attach(self));
163164
}
164165
self.objects
@@ -185,7 +186,7 @@ impl crate::Repository {
185186

186187
fn write_blob_stream_inner(&self, buf: &[u8]) -> Result<Id<'_>, object::write::Error> {
187188
let oid = gix_object::compute_hash(self.object_hash(), gix_object::Kind::Blob, buf);
188-
if self.objects.contains(&oid) {
189+
if self.objects.exists(&oid) {
189190
return Ok(oid.attach(self));
190191
}
191192

gix/src/repository/worktree.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ impl crate::Repository {
6262
&self,
6363
id: impl Into<gix_hash::ObjectId>,
6464
) -> Result<(gix_worktree_stream::Stream, gix_index::File), crate::repository::worktree_stream::Error> {
65-
use gix_odb::{FindExt, HeaderExt};
65+
use gix_object::FindExt;
66+
use gix_odb::HeaderExt;
6667
let id = id.into();
6768
let header = self.objects.header(id)?;
6869
if !header.kind().is_tree() {

gix/src/revision/walk.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use gix_hash::ObjectId;
2-
use gix_odb::FindExt;
2+
use gix_object::FindExt;
33

44
use crate::{ext::ObjectIdExt, revision, Repository};
55

gix/src/submodule/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::{
77
path::PathBuf,
88
};
99

10-
use gix_odb::FindExt;
10+
use gix_object::FindExt;
1111
pub use gix_submodule::*;
1212

1313
use crate::{bstr::BStr, repository::IndexPersistedOrInMemory, Repository, Submodule};

gix/tests/clone/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ mod blocking_io {
326326
match out.status {
327327
gix::remote::fetch::Status::Change { update_refs, .. } => {
328328
for edit in &update_refs.edits {
329-
use gix_odb::Find;
329+
use gix_object::Exists;
330330
match edit.change.new_value().expect("always set/no deletion") {
331331
TargetRef::Symbolic(referent) => {
332332
assert!(
@@ -335,7 +335,7 @@ mod blocking_io {
335335
)
336336
}
337337
TargetRef::Peeled(id) => {
338-
assert!(repo.objects.contains(id), "part of the fetched pack");
338+
assert!(repo.objects.exists(id), "part of the fetched pack");
339339
}
340340
}
341341
let r = repo

0 commit comments

Comments
 (0)