Skip to content

Commit

Permalink
adapt to changes in gix
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Aug 21, 2023
1 parent 28249bd commit 9fe3052
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 14 deletions.
2 changes: 2 additions & 0 deletions gitoxide-core/src/query/engine/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ impl query::Engine {
Some(spec.to_bstring()),
false,
&gix::index::State::new(self.repo.object_hash()),
gix::worktree::stack::state::attributes::Source::WorktreeThenIdMapping
.adjust_for_bare(self.repo.is_bare()),
)?
.search()
.patterns()
Expand Down
8 changes: 7 additions & 1 deletion gitoxide-core/src/repository/attributes/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ pub(crate) mod function {
}
}
PathsOrPatterns::Patterns(patterns) => {
let mut pathspec = repo.pathspec(patterns, true, &index)?;
let mut pathspec = repo.pathspec(
patterns,
true,
&index,
gix::worktree::stack::state::attributes::Source::WorktreeThenIdMapping
.adjust_for_bare(repo.is_bare()),
)?;
for (path, _entry) in pathspec
.index_entries_with_paths(&index)
.ok_or_else(|| anyhow!("Pathspec didn't match a single path in the index"))?
Expand Down
8 changes: 7 additions & 1 deletion gitoxide-core/src/repository/exclude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ pub fn query(
}
PathsOrPatterns::Patterns(patterns) => {
for (path, _entry) in repo
.pathspec(patterns.into_iter(), repo.work_dir().is_some(), &index)?
.pathspec(
patterns.into_iter(),
repo.work_dir().is_some(),
&index,
gix::worktree::stack::state::attributes::Source::WorktreeThenIdMapping
.adjust_for_bare(repo.is_bare()),
)?
.index_entries_with_paths(&index)
.ok_or_else(|| anyhow!("Pathspec didn't yield any entry"))?
{
Expand Down
21 changes: 10 additions & 11 deletions gitoxide-core/src/repository/index/entries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ pub(crate) mod function {
) -> anyhow::Result<()> {
use crate::OutputFormat::*;
let index = repo.index_or_load_from_head()?;
let pathspec = repo.pathspec(pathspecs, false, &index)?;
let pathspec = repo.pathspec(
pathspecs,
false,
&index,
gix::worktree::stack::state::attributes::Source::WorktreeThenIdMapping.adjust_for_bare(repo.is_bare()),
)?;
let mut cache = attributes
.or_else(|| {
pathspec
Expand All @@ -55,21 +60,15 @@ pub(crate) mod function {
&index,
match attrs {
Attributes::WorktreeAndIndex => {
if repo.is_bare() {
gix::worktree::stack::state::attributes::Source::IdMapping
} else {
gix::worktree::stack::state::attributes::Source::WorktreeThenIdMapping
}
gix::worktree::stack::state::attributes::Source::WorktreeThenIdMapping
.adjust_for_bare(repo.is_bare())
}
Attributes::Index => gix::worktree::stack::state::attributes::Source::IdMapping,
},
match attrs {
Attributes::WorktreeAndIndex => {
if repo.is_bare() {
gix::worktree::stack::state::ignore::Source::IdMapping
} else {
gix::worktree::stack::state::ignore::Source::WorktreeThenIdMappingIfNotSkipped
}
gix::worktree::stack::state::ignore::Source::WorktreeThenIdMappingIfNotSkipped
.adjust_for_bare(repo.is_bare())
}
Attributes::Index => gix::worktree::stack::state::ignore::Source::IdMapping,
},
Expand Down
2 changes: 1 addition & 1 deletion gix/src/worktree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ pub mod pathspec {
patterns,
inherit_ignore_case,
&index,
gix_worktree::cache::state::attributes::Source::WorktreeThenIdMapping,
gix_worktree::stack::state::attributes::Source::WorktreeThenIdMapping,
)?)
}
}
Expand Down

0 comments on commit 9fe3052

Please sign in to comment.