Skip to content

Commit 5b220db

Browse files
committed
adapt to changes in gix-status
1 parent 81ee2bc commit 5b220db

File tree

2 files changed

+14
-33
lines changed

2 files changed

+14
-33
lines changed

gitoxide-core/src/repository/status.rs

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -46,30 +46,19 @@ pub fn show(
4646
}
4747
let mut index = repo.index_or_empty()?;
4848
let index = gix::threading::make_mut(&mut index);
49-
let pathspec = repo.pathspec(
50-
pathspecs.iter().map(|p| p.as_bstr()),
51-
true,
52-
index,
53-
gix::worktree::stack::state::attributes::Source::WorktreeThenIdMapping,
54-
)?;
5549
let mut progress = progress.add_child("traverse index");
5650
let start = std::time::Instant::now();
51+
let stack = repo
52+
.attributes_only(
53+
index,
54+
gix::worktree::stack::state::attributes::Source::WorktreeThenIdMapping,
55+
)?
56+
.detach();
57+
let pathspec = gix::Pathspec::new(&repo, pathspecs.iter().map(|p| p.as_bstr()), true, || Ok(stack.clone()))?;
5758
let options = gix_status::index_as_worktree::Options {
5859
fs: repo.filesystem_options()?,
5960
thread_limit,
6061
stat: repo.stat_options()?,
61-
attributes: match repo
62-
.attributes_only(
63-
index,
64-
gix::worktree::stack::state::attributes::Source::WorktreeThenIdMapping,
65-
)?
66-
.detach()
67-
.state_mut()
68-
{
69-
gix::worktree::stack::State::AttributesStack(attrs) => std::mem::take(attrs),
70-
// TODO: this should be nicer by creating attributes directly, but it's a private API
71-
_ => unreachable!("state must be attributes stack only"),
72-
},
7362
};
7463
let mut printer = Printer {
7564
out,
@@ -80,7 +69,12 @@ pub fn show(
8069
.0
8170
.into_parts()
8271
.0;
83-
72+
let ctx = gix_status::index_as_worktree::Context {
73+
pathspec: pathspec.into_parts().0,
74+
stack,
75+
filter: filter_pipeline,
76+
should_interrupt: &gix::interrupt::IS_INTERRUPTED,
77+
};
8478
let mut collect = gix::dir::walk::delegate::Collect::default();
8579
let (outcome, walk_outcome) = gix::features::parallel::threads(|scope| -> anyhow::Result<_> {
8680
// TODO: it's either this, or not running both in parallel and setting UPTODATE flags whereever
@@ -114,9 +108,7 @@ pub fn show(
114108
Submodule,
115109
repo.objects.clone().into_arc()?,
116110
&mut progress,
117-
pathspec.detach()?,
118-
filter_pipeline,
119-
&gix::interrupt::IS_INTERRUPTED,
111+
ctx,
120112
options,
121113
)?;
122114

gix/src/pathspec.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,3 @@ impl PathspecDetached {
191191
.map_or(false, |m| !m.is_excluded())
192192
}
193193
}
194-
195-
#[cfg(feature = "status")]
196-
impl gix_status::Pathspec for PathspecDetached {
197-
fn common_prefix(&self) -> &BStr {
198-
self.search.common_prefix()
199-
}
200-
201-
fn is_included(&mut self, relative_path: &BStr, is_dir: Option<bool>) -> bool {
202-
self.is_included(relative_path, is_dir)
203-
}
204-
}

0 commit comments

Comments
 (0)