Skip to content

Commit 4ef7806

Browse files
committed
adapt to changes in gix-ignore and gix-glob, and more.
1 parent 85a24b3 commit 4ef7806

File tree

14 files changed

+28
-9
lines changed

14 files changed

+28
-9
lines changed

gitoxide-core/src/repository/exclude.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ pub fn query(
3737
let index = repo.index()?;
3838
let mut cache = repo.excludes(
3939
&index,
40-
Some(gix::ignore::Search::from_overrides(overrides.into_iter())),
40+
Some(gix::ignore::Search::from_overrides(
41+
overrides.into_iter(),
42+
repo.ignore_pattern_parser()?,
43+
)),
4144
Default::default(),
4245
)?;
4346

gix-dir/tests/walk_utils/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ pub fn try_collect_filtered_opts(
330330
Default::default(),
331331
None,
332332
gix_worktree::stack::state::ignore::Source::WorktreeThenIdMappingIfNotSkipped,
333+
gix_ignore::search::Ignore { support_precious: true },
333334
)),
334335
&index,
335336
index.path_backing(),
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

gix-filter/tests/pipeline/mod.rs renamed to gix-filter/tests/filter/pipeline/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ fn attribute_cache(name: &str) -> gix_testtools::Result<gix_worktree::Stack> {
3838
Default::default(),
3939
None,
4040
gix_worktree::stack::state::ignore::Source::WorktreeThenIdMappingIfNotSkipped,
41+
Default::default(),
4142
),
4243
),
4344
Case::Sensitive,

gix/src/config/cache/access.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,18 @@ impl Cache {
384384
})
385385
}
386386

387+
#[cfg(feature = "excludes")]
388+
pub(crate) fn ignore_pattern_parser(&self) -> Result<gix_ignore::search::Ignore, config::boolean::Error> {
389+
Ok(gix_ignore::search::Ignore {
390+
support_precious: boolean(
391+
self,
392+
"gitoxide.parsePrecious",
393+
&config::tree::Gitoxide::PARSE_PRECIOUS,
394+
false,
395+
)?,
396+
})
397+
}
398+
387399
#[cfg(feature = "excludes")]
388400
pub(crate) fn assemble_exclude_globals(
389401
&self,
@@ -396,14 +408,7 @@ impl Cache {
396408
Some(user_path) => Some(user_path),
397409
None => self.xdg_config_path("ignore")?,
398410
};
399-
let parse_ignore = gix_ignore::search::Ignore {
400-
support_precious: boolean(
401-
self,
402-
"gitoxide.parsePrecious",
403-
&config::tree::Gitoxide::PARSE_PRECIOUS,
404-
false,
405-
)?,
406-
};
411+
let parse_ignore = self.ignore_pattern_parser()?;
407412
Ok(gix_worktree::stack::state::Ignore::new(
408413
overrides.unwrap_or_default(),
409414
gix_ignore::Search::from_git_dir(git_dir, excludes_file, buf, parse_ignore)?,

gix/src/repository/config/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ impl crate::Repository {
4848
self.config.big_file_threshold()
4949
}
5050

51+
/// Create a low-level parser for ignore patterns, for instance for use in [`excludes()`](crate::Repository::excludes()).
52+
///
53+
/// Depending on the configuration, precious-file parsing in `.gitignore-files` is supported.
54+
/// This means that `$` prefixed files will be interpreted as precious, which is a backwards-incompatible change.
55+
#[cfg(feature = "excludes")]
56+
pub fn ignore_pattern_parser(&self) -> Result<gix_ignore::search::Ignore, config::boolean::Error> {
57+
self.config.ignore_pattern_parser()
58+
}
59+
5160
/// Obtain options for use when connecting via `ssh`.
5261
#[cfg(feature = "blocking-network-client")]
5362
pub fn ssh_connect_options(

0 commit comments

Comments
 (0)