Skip to content

Commit cac51b2

Browse files
committed
adapt to changes in gix-worktree
1 parent 09f8063 commit cac51b2

File tree

29 files changed

+109
-105
lines changed

29 files changed

+109
-105
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gitoxide-core/src/hours/core.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ pub fn spawn_tree_delta_threads<'scope>(
101101
repo.index_or_load_from_head().map_err(Into::into).and_then(|index| {
102102
repo.attributes(
103103
&index,
104-
gix::worktree::cache::state::attributes::Source::IdMapping,
105-
gix::worktree::cache::state::ignore::Source::IdMapping,
104+
gix::worktree::stack::state::attributes::Source::IdMapping,
105+
gix::worktree::stack::state::ignore::Source::IdMapping,
106106
None,
107107
)
108108
.map_err(Into::into)

gitoxide-core/src/index/checkout.rs

Lines changed: 4 additions & 4 deletions
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::checkout, Progress};
7+
use gix::{odb::FindExt, worktree::state::checkout, Progress};
88

99
use crate::{
1010
index,
@@ -55,7 +55,7 @@ pub fn checkout_exclusive(
5555
progress.info(format!("Skipping {num_skipped} DIR/SYMLINK/COMMIT entries"));
5656
}
5757

58-
let opts = gix::worktree::checkout::Options {
58+
let opts = gix::worktree::state::checkout::Options {
5959
fs: gix::fs::Capabilities::probe(dest_directory),
6060

6161
destination_is_initially_empty: true,
@@ -86,7 +86,7 @@ pub fn checkout_exclusive(
8686
delayed_paths_unknown,
8787
delayed_paths_unprocessed,
8888
} = match repo {
89-
Some(repo) => gix::worktree::checkout(
89+
Some(repo) => gix::worktree::state::checkout(
9090
&mut index,
9191
dest_directory,
9292
{
@@ -109,7 +109,7 @@ pub fn checkout_exclusive(
109109
should_interrupt,
110110
opts,
111111
),
112-
None => gix::worktree::checkout(
112+
None => gix::worktree::state::checkout(
113113
&mut index,
114114
dest_directory,
115115
|_, buf| {

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,16 @@ pub(crate) mod function {
8989

9090
pub(crate) fn attributes_cache(
9191
repo: &gix::Repository,
92-
) -> anyhow::Result<(gix::worktree::Cache, IndexPersistedOrInMemory)> {
92+
) -> anyhow::Result<(gix::worktree::Stack, IndexPersistedOrInMemory)> {
9393
let index = repo.index_or_load_from_head()?;
9494
let cache = repo.attributes(
9595
&index,
9696
if repo.is_bare() {
97-
gix::worktree::cache::state::attributes::Source::IdMapping
97+
gix::worktree::stack::state::attributes::Source::IdMapping
9898
} else {
99-
gix::worktree::cache::state::attributes::Source::WorktreeThenIdMapping
99+
gix::worktree::stack::state::attributes::Source::WorktreeThenIdMapping
100100
},
101-
gix::worktree::cache::state::ignore::Source::IdMapping,
101+
gix::worktree::stack::state::ignore::Source::IdMapping,
102102
None,
103103
)?;
104104
Ok((cache, index))

gitoxide-core/src/repository/clone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ pub(crate) mod function {
111111
}
112112
};
113113

114-
if let Some(gix::worktree::checkout::Outcome { collisions, errors, .. }) = outcome {
114+
if let Some(gix::worktree::state::checkout::Outcome { collisions, errors, .. }) = outcome {
115115
if !(collisions.is_empty() && errors.is_empty()) {
116116
let mut messages = Vec::new();
117117
if !errors.is_empty() {

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,22 @@ pub(crate) mod function {
5656
match attrs {
5757
Attributes::WorktreeAndIndex => {
5858
if repo.is_bare() {
59-
gix::worktree::cache::state::attributes::Source::IdMapping
59+
gix::worktree::stack::state::attributes::Source::IdMapping
6060
} else {
61-
gix::worktree::cache::state::attributes::Source::WorktreeThenIdMapping
61+
gix::worktree::stack::state::attributes::Source::WorktreeThenIdMapping
6262
}
6363
}
64-
Attributes::Index => gix::worktree::cache::state::attributes::Source::IdMapping,
64+
Attributes::Index => gix::worktree::stack::state::attributes::Source::IdMapping,
6565
},
6666
match attrs {
6767
Attributes::WorktreeAndIndex => {
6868
if repo.is_bare() {
69-
gix::worktree::cache::state::ignore::Source::IdMapping
69+
gix::worktree::stack::state::ignore::Source::IdMapping
7070
} else {
71-
gix::worktree::cache::state::ignore::Source::WorktreeThenIdMappingIfNotSkipped
71+
gix::worktree::stack::state::ignore::Source::WorktreeThenIdMappingIfNotSkipped
7272
}
7373
}
74-
Attributes::Index => gix::worktree::cache::state::ignore::Source::IdMapping,
74+
Attributes::Index => gix::worktree::stack::state::ignore::Source::IdMapping,
7575
},
7676
None,
7777
)
@@ -203,7 +203,7 @@ pub(crate) mod function {
203203
pub excluded: usize,
204204
pub with_attributes: usize,
205205
pub max_attributes_per_path: usize,
206-
pub cache: Option<gix::worktree::cache::Statistics>,
206+
pub cache: Option<gix::worktree::stack::Statistics>,
207207
}
208208

209209
#[cfg(feature = "serde")]

gix-archive/tests/archive.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ mod from_tree {
1111
use gix_object::tree::EntryMode;
1212
use gix_odb::FindExt;
1313
use gix_testtools::bstr::ByteSlice;
14-
use gix_worktree::cache::state::attributes::Source;
14+
use gix_worktree::stack::state::attributes::Source;
1515

1616
use crate::hex_to_id;
1717

@@ -284,7 +284,7 @@ mod from_tree {
284284
Ok(())
285285
}
286286

287-
fn basic() -> gix_testtools::Result<(PathBuf, gix_hash::ObjectId, gix_odb::HandleArc, gix_worktree::Cache)> {
287+
fn basic() -> gix_testtools::Result<(PathBuf, gix_hash::ObjectId, gix_odb::HandleArc, gix_worktree::Stack)> {
288288
let dir = gix_testtools::scripted_fixture_read_only("basic.sh")?;
289289

290290
let head = {
@@ -295,14 +295,14 @@ mod from_tree {
295295

296296
let mut collection = Default::default();
297297
let mut buf = Default::default();
298-
let attributes = gix_worktree::cache::state::Attributes::new(
298+
let attributes = gix_worktree::stack::state::Attributes::new(
299299
gix_attributes::Search::new_globals(None::<PathBuf>, &mut buf, &mut collection)?,
300300
None,
301301
Source::WorktreeThenIdMapping,
302302
collection,
303303
);
304-
let state = gix_worktree::cache::State::AttributesStack(attributes);
305-
let cache = gix_worktree::Cache::new(&dir, state, Case::Sensitive, Default::default(), Default::default());
304+
let state = gix_worktree::stack::State::AttributesStack(attributes);
305+
let cache = gix_worktree::Stack::new(&dir, state, Case::Sensitive, Default::default(), Default::default());
306306
Ok((dir, head, odb.into_arc()?, cache))
307307
}
308308

gix-filter/tests/pipeline/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,22 @@ fn default() -> crate::Result {
1717
Ok(())
1818
}
1919

20-
fn attribute_cache(name: &str) -> gix_testtools::Result<gix_worktree::Cache> {
20+
fn attribute_cache(name: &str) -> gix_testtools::Result<gix_worktree::Stack> {
2121
let dir = gix_testtools::scripted_fixture_read_only("pipeline_repos.sh")?.join(name);
22-
Ok(gix_worktree::Cache::new(
22+
Ok(gix_worktree::Stack::new(
2323
dir,
24-
gix_worktree::cache::State::for_add(
25-
gix_worktree::cache::state::Attributes::new(
24+
gix_worktree::stack::State::for_add(
25+
gix_worktree::stack::state::Attributes::new(
2626
Default::default(),
2727
None,
28-
gix_worktree::cache::state::attributes::Source::WorktreeThenIdMapping,
28+
gix_worktree::stack::state::attributes::Source::WorktreeThenIdMapping,
2929
Default::default(),
3030
),
31-
gix_worktree::cache::state::Ignore::new(
31+
gix_worktree::stack::state::Ignore::new(
3232
Default::default(),
3333
Default::default(),
3434
None,
35-
gix_worktree::cache::state::ignore::Source::WorktreeThenIdMappingIfNotSkipped,
35+
gix_worktree::stack::state::ignore::Source::WorktreeThenIdMappingIfNotSkipped,
3636
),
3737
),
3838
Case::Sensitive,
@@ -49,7 +49,7 @@ fn pipeline(
4949
gix_filter::pipeline::CrlfRoundTripCheck,
5050
eol::Configuration,
5151
),
52-
) -> gix_testtools::Result<(gix_worktree::Cache, gix_filter::Pipeline)> {
52+
) -> gix_testtools::Result<(gix_worktree::Stack, gix_filter::Pipeline)> {
5353
let cache = attribute_cache(name)?;
5454
let (drivers, encodings_with_roundtrip_check, crlf_roundtrip_check, eol_config) = init();
5555
let pipe = gix_filter::Pipeline::new(

gix-status/src/index_as_worktree/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use bstr::BStr;
22

3-
/// The error returned by [`status()`][crate::status()].
3+
/// The error returned by [`status()`](crate::index_as_worktree()).
44
#[derive(Debug, thiserror::Error)]
55
#[allow(missing_docs)]
66
pub enum Error {
@@ -40,7 +40,7 @@ pub enum Change<T = ()> {
4040
/// Indicates that one of the stat changes was an executable bit change
4141
/// which is a significant change itself.
4242
executable_bit_changed: bool,
43-
/// The output of the [`CompareBlobs`][crate::status::content::CompareBlobs] run on this entry.
43+
/// The output of the [`CompareBlobs`](crate::index_as_worktree::content::CompareBlobs) run on this entry.
4444
/// If there is no content change and only the executable bit
4545
/// changed than this is `None`.
4646
content_change: Option<T>,

gix-worktree-state/src/checkout/chunk.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use bstr::{BStr, BString};
77
use gix_hash::oid;
88

99
use crate::{checkout, checkout::entry};
10-
use gix_worktree::Cache;
10+
use gix_worktree::Stack;
1111

1212
mod reduce {
1313
use std::marker::PhantomData;
@@ -92,7 +92,7 @@ pub struct Outcome<'a> {
9292
#[derive(Clone)]
9393
pub struct Context<Find: Clone> {
9494
pub find: Find,
95-
pub path_cache: Cache,
95+
pub path_cache: Stack,
9696
pub filters: gix_filter::Pipeline,
9797
pub buf: Vec<u8>,
9898
pub options: Options,

gix-worktree-state/src/checkout/entry.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ use gix_hash::oid;
1010
use gix_index::{entry::Stat, Entry};
1111
use io_close::Close;
1212

13-
use gix_worktree::Cache;
13+
use gix_worktree::Stack;
1414

1515
pub struct Context<'a, Find> {
1616
pub find: &'a mut Find,
17-
pub path_cache: &'a mut Cache,
17+
pub path_cache: &'a mut Stack,
1818
pub filters: &'a mut gix_filter::Pipeline,
1919
pub buf: &'a mut Vec<u8>,
2020
}

gix-worktree-state/src/checkout/function.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use gix_features::{interrupt, parallel::in_parallel_with_finalize, progress::Pro
44
use gix_hash::oid;
55

66
use crate::checkout::chunk;
7-
use gix_worktree::{cache, Cache};
7+
use gix_worktree::{stack, Stack};
88

99
/// Checkout the entire `index` into `dir`, and resolve objects found in index entries with `find` to write their content to their
1010
/// respective path in `dir`.
@@ -66,12 +66,12 @@ where
6666
None,
6767
);
6868

69-
let state = cache::State::for_checkout(options.overwrite_existing, std::mem::take(&mut options.attributes));
69+
let state = stack::State::for_checkout(options.overwrite_existing, std::mem::take(&mut options.attributes));
7070
let attribute_files = state.id_mappings_from_index(index, paths, case);
7171
let mut ctx = chunk::Context {
7272
buf: Vec::new(),
7373
options: (&options).into(),
74-
path_cache: Cache::new(dir, state, case, Vec::with_capacity(512), attribute_files),
74+
path_cache: Stack::new(dir, state, case, Vec::with_capacity(512), attribute_files),
7575
filters: options.filters,
7676
find,
7777
};

gix-worktree-state/src/checkout/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub struct Options {
6060
/// Control how stat comparisons are made when checking if a file is fresh.
6161
pub stat_options: stat::Options,
6262
/// A stack of attributes to use with the filesystem cache to use as driver for filters.
63-
pub attributes: gix_worktree::cache::state::Attributes,
63+
pub attributes: gix_worktree::stack::state::Attributes,
6464
/// The filter pipeline to use for applying mandatory filters before writing to the worktree.
6565
pub filters: gix_filter::Pipeline,
6666
/// Control how long-running processes may use the 'delay' capability.

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use gix_features::progress;
1111
use gix_object::bstr::ByteSlice;
1212
use gix_odb::FindExt;
1313
use gix_testtools::tempfile::TempDir;
14-
use gix_worktree::checkout::Collision;
14+
use gix_worktree_state::checkout::Collision;
1515
use once_cell::sync::Lazy;
1616

1717
use crate::fixture_path;
@@ -454,26 +454,26 @@ pub fn dir_structure<P: AsRef<std::path::Path>>(path: P) -> Vec<std::path::PathB
454454
}
455455

456456
fn checkout_index_in_tmp_dir(
457-
opts: gix_worktree::checkout::Options,
457+
opts: gix_worktree_state::checkout::Options,
458458
name: &str,
459-
) -> crate::Result<(PathBuf, TempDir, gix_index::File, gix_worktree::checkout::Outcome)> {
459+
) -> crate::Result<(PathBuf, TempDir, gix_index::File, gix_worktree_state::checkout::Outcome)> {
460460
checkout_index_in_tmp_dir_opts(opts, name, |_d| true, |_| Ok(()))
461461
}
462462

463463
fn checkout_index_in_tmp_dir_opts(
464-
opts: gix_worktree::checkout::Options,
464+
opts: gix_worktree_state::checkout::Options,
465465
name: &str,
466466
mut allow_return_object: impl FnMut(&gix_hash::oid) -> bool + Send + Clone,
467467
prep_dest: impl Fn(&Path) -> std::io::Result<()>,
468-
) -> crate::Result<(PathBuf, TempDir, gix_index::File, gix_worktree::checkout::Outcome)> {
468+
) -> crate::Result<(PathBuf, TempDir, gix_index::File, gix_worktree_state::checkout::Outcome)> {
469469
let source_tree = fixture_path(name);
470470
let git_dir = source_tree.join(".git");
471471
let mut index = gix_index::File::at(git_dir.join("index"), gix_hash::Kind::Sha1, Default::default())?;
472472
let odb = gix_odb::at(git_dir.join("objects"))?.into_inner().into_arc()?;
473473
let destination = gix_testtools::tempfile::tempdir_in(std::env::current_dir()?)?;
474474
prep_dest(destination.path()).expect("preparation must succeed");
475475

476-
let outcome = gix_worktree::checkout(
476+
let outcome = gix_worktree_state::checkout(
477477
&mut index,
478478
destination.path(),
479479
move |oid, buf| {
@@ -501,8 +501,8 @@ fn probe_gitoxide_dir() -> crate::Result<gix_fs::Capabilities> {
501501
))
502502
}
503503

504-
fn opts_from_probe() -> gix_worktree::checkout::Options {
505-
gix_worktree::checkout::Options {
504+
fn opts_from_probe() -> gix_worktree_state::checkout::Options {
505+
gix_worktree_state::checkout::Options {
506506
fs: probe_gitoxide_dir().unwrap(),
507507
destination_is_initially_empty: true,
508508
thread_limit: gix_features::parallel::num_threads(None).into(),

gix-worktree-stream/tests/stream.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ mod from_tree {
1515
use gix_object::{bstr::ByteSlice, tree::EntryMode};
1616
use gix_odb::FindExt;
1717
use gix_testtools::once_cell::sync::Lazy;
18-
use gix_worktree::cache::state::attributes::Source;
18+
use gix_worktree::stack::state::attributes::Source;
1919

2020
use crate::hex_to_id;
2121

@@ -231,7 +231,7 @@ mod from_tree {
231231
Ok(())
232232
}
233233

234-
fn basic() -> gix_testtools::Result<(PathBuf, gix_hash::ObjectId, gix_odb::HandleArc, gix_worktree::Cache)> {
234+
fn basic() -> gix_testtools::Result<(PathBuf, gix_hash::ObjectId, gix_odb::HandleArc, gix_worktree::Stack)> {
235235
let dir = gix_testtools::scripted_fixture_read_only("basic.sh")?;
236236

237237
let head = {
@@ -242,14 +242,14 @@ mod from_tree {
242242

243243
let mut collection = Default::default();
244244
let mut buf = Default::default();
245-
let attributes = gix_worktree::cache::state::Attributes::new(
245+
let attributes = gix_worktree::stack::state::Attributes::new(
246246
gix_attributes::Search::new_globals(None::<PathBuf>, &mut buf, &mut collection)?,
247247
None,
248248
Source::WorktreeThenIdMapping,
249249
collection,
250250
);
251-
let state = gix_worktree::cache::State::AttributesStack(attributes);
252-
let cache = gix_worktree::Cache::new(&dir, state, Case::Sensitive, Default::default(), Default::default());
251+
let state = gix_worktree::stack::State::AttributesStack(attributes);
252+
let cache = gix_worktree::Stack::new(&dir, state, Case::Sensitive, Default::default(), Default::default());
253253
Ok((dir, head, odb.into_arc()?, cache))
254254
}
255255

gix-worktree/src/stack/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl Stack {
8181
/// symlinks are in that path.
8282
/// Unless `is_dir` is known with `Some(…)`, then `relative` points to a directory itself in which case the entire resulting
8383
/// path is created as directory. If it's not known it is assumed to be a file.
84-
/// `find` maybe used to lookup objects from an [id mapping][crate::cache::State::id_mappings_from_index()], with mappnigs
84+
/// `find` maybe used to lookup objects from an [id mapping][crate::stack::State::id_mappings_from_index()], with mappnigs
8585
///
8686
/// Provide access to cached information for that `relative` path via the returned platform.
8787
pub fn at_path<Find, E>(
@@ -110,7 +110,7 @@ impl Stack {
110110

111111
/// Obtain a platform for lookups from a repo-`relative` path, typically obtained from an index entry. `is_dir` should reflect
112112
/// whether it's a directory or not, or left at `None` if unknown.
113-
/// `find` maybe used to lookup objects from an [id mapping][crate::cache::State::id_mappings_from_index()].
113+
/// `find` maybe used to lookup objects from an [id mapping][crate::stack::State::id_mappings_from_index()].
114114
/// All effects are similar to [`at_path()`][Self::at_path()].
115115
///
116116
/// If `relative` ends with `/` and `is_dir` is `None`, it is automatically assumed to be a directory.

0 commit comments

Comments
 (0)