Skip to content

Commit 9df4929

Browse files
committed
adapt to changes in gix
1 parent 54291fd commit 9df4929

File tree

4 files changed

+29
-38
lines changed

4 files changed

+29
-38
lines changed

gitoxide-core/src/hours/core.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{
66
},
77
};
88

9-
use gix::{bstr::BStr, odb::FindExt};
9+
use gix::bstr::BStr;
1010
use itertools::Itertools;
1111
use smallvec::SmallVec;
1212

@@ -182,11 +182,7 @@ pub fn spawn_tree_delta_threads<'scope>(
182182
(true, true) => {
183183
files.modified += 1;
184184
if let Some((attrs, matches)) = attributes.as_mut() {
185-
let entry = attrs.at_entry(
186-
change.location,
187-
Some(false),
188-
|id, buf| repo.objects.find_blob(id, buf),
189-
)?;
185+
let entry = attrs.at_entry(change.location, Some(false))?;
190186
let is_text_file = if entry.matching_attributes(matches) {
191187
let attrs: SmallVec<[_; 2]> =
192188
matches.iter_selected().collect();

gitoxide-core/src/repository/attributes/query.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub(crate) mod function {
1111
use std::{io, path::Path};
1212

1313
use anyhow::{anyhow, bail};
14-
use gix::{bstr::BStr, prelude::FindExt};
14+
use gix::bstr::BStr;
1515

1616
use crate::{
1717
repository::{
@@ -40,7 +40,7 @@ pub(crate) mod function {
4040
for path in paths {
4141
let is_dir = gix::path::from_bstr(path.as_ref()).metadata().ok().map(|m| m.is_dir());
4242

43-
let entry = cache.at_entry(path.as_slice(), is_dir, |oid, buf| repo.objects.find_blob(oid, buf))?;
43+
let entry = cache.at_entry(path.as_slice(), is_dir)?;
4444
if !entry.matching_attributes(&mut matches) {
4545
continue;
4646
}
@@ -59,7 +59,7 @@ pub(crate) mod function {
5959
.index_entries_with_paths(&index)
6060
.ok_or_else(|| anyhow!("Pathspec didn't match a single path in the index"))?
6161
{
62-
let entry = cache.at_entry(path, Some(false), |oid, buf| repo.objects.find_blob(oid, buf))?;
62+
let entry = cache.at_entry(path, Some(false))?;
6363
if !entry.matching_attributes(&mut matches) {
6464
continue;
6565
}
@@ -97,7 +97,7 @@ pub(crate) mod function {
9797

9898
pub(crate) fn attributes_cache(
9999
repo: &gix::Repository,
100-
) -> anyhow::Result<(gix::worktree::Stack, IndexPersistedOrInMemory)> {
100+
) -> anyhow::Result<(gix::AttributeStack<'_>, IndexPersistedOrInMemory)> {
101101
let index = repo.index_or_load_from_head()?;
102102
let cache = repo.attributes(
103103
&index,

gitoxide-core/src/repository/attributes/validate_baseline.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub(crate) mod function {
1818
};
1919

2020
use anyhow::{anyhow, bail};
21-
use gix::{attrs::Assignment, bstr::BString, odb::FindExt, Progress};
21+
use gix::{attrs::Assignment, bstr::BString, Progress};
2222

2323
use crate::{
2424
repository::attributes::{query::attributes_cache, validate_baseline::Options},
@@ -192,9 +192,7 @@ pub(crate) mod function {
192192
);
193193

194194
for (rela_path, baseline) in rx_base {
195-
let entry = cache.at_entry(rela_path.as_str(), Some(false), |oid, buf| {
196-
repo.objects.find_blob(oid, buf)
197-
})?;
195+
let entry = cache.at_entry(rela_path.as_str(), Some(false))?;
198196
match baseline {
199197
Baseline::Attribute { assignments: expected } => {
200198
entry.matching_attributes(&mut matches);

gitoxide-core/src/repository/index/entries.rs

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ pub(crate) mod function {
2525

2626
use gix::{
2727
bstr::{BStr, BString},
28-
odb::FindExt,
2928
repository::IndexPersistedOrInMemory,
3029
Repository,
3130
};
@@ -133,27 +132,25 @@ pub(crate) mod function {
133132
.and_then(|(attrs, cache)| {
134133
// If the user wants to see assigned attributes, we always have to match.
135134
attributes.is_some().then(|| {
136-
cache
137-
.at_entry(entry.path(&index), None, |id, buf| repo.objects.find_blob(id, buf))
138-
.map(|entry| {
139-
let is_excluded = entry.is_excluded();
140-
stats.excluded += usize::from(is_excluded);
141-
let attributes: Vec<_> = {
142-
last_match = Some(entry.matching_attributes(attrs));
143-
attrs.iter().map(|m| m.assignment.to_owned()).collect()
144-
};
145-
stats.with_attributes += usize::from(!attributes.is_empty());
146-
stats.max_attributes_per_path = stats.max_attributes_per_path.max(attributes.len());
147-
if let Some(attrs) = repo_attrs.as_mut() {
148-
attributes.iter().for_each(|attr| {
149-
attrs.insert(attr.clone());
150-
});
151-
}
152-
Attrs {
153-
is_excluded,
154-
attributes,
155-
}
156-
})
135+
cache.at_entry(entry.path(&index), None).map(|entry| {
136+
let is_excluded = entry.is_excluded();
137+
stats.excluded += usize::from(is_excluded);
138+
let attributes: Vec<_> = {
139+
last_match = Some(entry.matching_attributes(attrs));
140+
attrs.iter().map(|m| m.assignment.to_owned()).collect()
141+
};
142+
stats.with_attributes += usize::from(!attributes.is_empty());
143+
stats.max_attributes_per_path = stats.max_attributes_per_path.max(attributes.len());
144+
if let Some(attrs) = repo_attrs.as_mut() {
145+
attributes.iter().for_each(|attr| {
146+
attrs.insert(attr.clone());
147+
});
148+
}
149+
Attrs {
150+
is_excluded,
151+
attributes,
152+
}
153+
})
157154
})
158155
})
159156
.transpose()?;
@@ -173,7 +170,7 @@ pub(crate) mod function {
173170
}
174171
// The user doesn't want attributes, so we set the cache position on demand only
175172
None => cache
176-
.at_entry(rela_path, Some(is_dir), |id, buf| repo.objects.find_blob(id, buf))
173+
.at_entry(rela_path, Some(is_dir))
177174
.ok()
178175
.map(|platform| platform.matching_attributes(out))
179176
.unwrap_or_default(),
@@ -251,7 +248,7 @@ pub(crate) mod function {
251248
) -> anyhow::Result<(
252249
gix::pathspec::Search,
253250
IndexPersistedOrInMemory,
254-
Option<(gix::attrs::search::Outcome, gix::worktree::Stack)>,
251+
Option<(gix::attrs::search::Outcome, gix::AttributeStack<'_>)>,
255252
)> {
256253
let index = repo.index_or_load_from_head()?;
257254
let pathspec = repo.pathspec(

0 commit comments

Comments
 (0)