questionable test

This commit is contained in:
Robin Malfait 2026-08-12 18:55:05 +02:00
parent 6d9d3b65e4
commit cdcbf98744
No known key found for this signature in database

View file

@ -4215,6 +4215,30 @@ mod scanner {
assert_eq!(files, vec!["blog/2024/post/index.html"]);
}
#[test]
fn unpinned_globs_do_not_reinclude_gitignored_directories() {
// The whitelist of an unpinned glob like `./blog/*/**/*` could also match *directory*
// paths (unlike e.g. `./**/*.html`, which only ever matches files). It must not: the
// wildcard part of a glob is not explicit, so git ignored directories inside the
// walked subtree stay pruned, even when the whitelisted glob happens to match them.
let ScanResult {
candidates, files, ..
} = scan_with_globs(
&[
("blog/.gitignore", "drafts/"),
("blog/2024/keep.html", "content-['blog/2024/keep.html']"),
(
"blog/2024/drafts/secret.html",
"content-['blog/2024/drafts/secret.html']",
),
],
vec!["@source './blog/*/**/*'"],
);
assert_eq!(candidates, vec!["content-['blog/2024/keep.html']"]);
assert_eq!(files, vec!["blog/2024/keep.html"]);
}
#[test]
fn external_sources_ignore_nested_default_ignored_directories() {
// An explicitly listed, git ignored directory (external source) still applies the