Skip to content

Commit 7c6b85c

Browse files
authored
Merge pull request #247 from epage/search
fix(cli): Discover config in parent dirs
2 parents cc5c2b6 + 1a1ff20 commit 7c6b85c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/config.rs

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ impl Config {
1717
let config = if let Some(path) =
1818
find_project_file(cwd, &["typos.toml", "_typos.toml", ".typos.toml"])
1919
{
20+
log::debug!("Loading {}", path.display());
2021
Some(Self::from_file(&path)?)
2122
} else {
2223
None

src/policy.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,11 @@ impl<'s> ConfigEngine<'s> {
123123
let mut config = crate::config::Config::default();
124124

125125
if !self.isolated {
126-
if let Some(derived) = crate::config::Config::from_dir(cwd)? {
127-
config.update(&derived);
126+
for ancestor in cwd.ancestors() {
127+
if let Some(derived) = crate::config::Config::from_dir(ancestor)? {
128+
config.update(&derived);
129+
break;
130+
}
128131
}
129132
}
130133
if let Some(overrides) = self.overrides.as_ref() {

0 commit comments

Comments
 (0)