Skip to content

Commit 9fe3052

Browse files
committed
adapt to changes in gix
1 parent 28249bd commit 9fe3052

File tree

5 files changed

+27
-14
lines changed

5 files changed

+27
-14
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ impl query::Engine {
2626
Some(spec.to_bstring()),
2727
false,
2828
&gix::index::State::new(self.repo.object_hash()),
29+
gix::worktree::stack::state::attributes::Source::WorktreeThenIdMapping
30+
.adjust_for_bare(self.repo.is_bare()),
2931
)?
3032
.search()
3133
.patterns()

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,13 @@ pub(crate) mod function {
4646
}
4747
}
4848
PathsOrPatterns::Patterns(patterns) => {
49-
let mut pathspec = repo.pathspec(patterns, true, &index)?;
49+
let mut pathspec = repo.pathspec(
50+
patterns,
51+
true,
52+
&index,
53+
gix::worktree::stack::state::attributes::Source::WorktreeThenIdMapping
54+
.adjust_for_bare(repo.is_bare()),
55+
)?;
5056
for (path, _entry) in pathspec
5157
.index_entries_with_paths(&index)
5258
.ok_or_else(|| anyhow!("Pathspec didn't match a single path in the index"))?

gitoxide-core/src/repository/exclude.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,13 @@ pub fn query(
5656
}
5757
PathsOrPatterns::Patterns(patterns) => {
5858
for (path, _entry) in repo
59-
.pathspec(patterns.into_iter(), repo.work_dir().is_some(), &index)?
59+
.pathspec(
60+
patterns.into_iter(),
61+
repo.work_dir().is_some(),
62+
&index,
63+
gix::worktree::stack::state::attributes::Source::WorktreeThenIdMapping
64+
.adjust_for_bare(repo.is_bare()),
65+
)?
6066
.index_entries_with_paths(&index)
6167
.ok_or_else(|| anyhow!("Pathspec didn't yield any entry"))?
6268
{

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

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ pub(crate) mod function {
4141
) -> anyhow::Result<()> {
4242
use crate::OutputFormat::*;
4343
let index = repo.index_or_load_from_head()?;
44-
let pathspec = repo.pathspec(pathspecs, false, &index)?;
44+
let pathspec = repo.pathspec(
45+
pathspecs,
46+
false,
47+
&index,
48+
gix::worktree::stack::state::attributes::Source::WorktreeThenIdMapping.adjust_for_bare(repo.is_bare()),
49+
)?;
4550
let mut cache = attributes
4651
.or_else(|| {
4752
pathspec
@@ -55,21 +60,15 @@ pub(crate) mod function {
5560
&index,
5661
match attrs {
5762
Attributes::WorktreeAndIndex => {
58-
if repo.is_bare() {
59-
gix::worktree::stack::state::attributes::Source::IdMapping
60-
} else {
61-
gix::worktree::stack::state::attributes::Source::WorktreeThenIdMapping
62-
}
63+
gix::worktree::stack::state::attributes::Source::WorktreeThenIdMapping
64+
.adjust_for_bare(repo.is_bare())
6365
}
6466
Attributes::Index => gix::worktree::stack::state::attributes::Source::IdMapping,
6567
},
6668
match attrs {
6769
Attributes::WorktreeAndIndex => {
68-
if repo.is_bare() {
69-
gix::worktree::stack::state::ignore::Source::IdMapping
70-
} else {
71-
gix::worktree::stack::state::ignore::Source::WorktreeThenIdMappingIfNotSkipped
72-
}
70+
gix::worktree::stack::state::ignore::Source::WorktreeThenIdMappingIfNotSkipped
71+
.adjust_for_bare(repo.is_bare())
7372
}
7473
Attributes::Index => gix::worktree::stack::state::ignore::Source::IdMapping,
7574
},

gix/src/worktree/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ pub mod pathspec {
232232
patterns,
233233
inherit_ignore_case,
234234
&index,
235-
gix_worktree::cache::state::attributes::Source::WorktreeThenIdMapping,
235+
gix_worktree::stack::state::attributes::Source::WorktreeThenIdMapping,
236236
)?)
237237
}
238238
}

0 commit comments

Comments
 (0)