Skip to content

Commit

Permalink
refactor(config): Clarify duplicate-load check
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Sep 25, 2024
1 parent d5cb6b5 commit 0b83e92
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cargo/util/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1581,20 +1581,20 @@ impl GlobalContext {
where
F: FnMut(&Path) -> CargoResult<()>,
{
let mut stash: HashSet<PathBuf> = HashSet::new();
let mut seen = HashSet::new();

for current in paths::ancestors(pwd, self.search_stop_path.as_deref()) {
if let Some(path) = self.get_file_path(&current.join(".cargo"), "config", true)? {
walk(&path)?;
stash.insert(path);
seen.insert(path);
}
}

// Once we're done, also be sure to walk the home directory even if it's not
// in our history to be sure we pick up that standard location for
// information.
if let Some(path) = self.get_file_path(home, "config", true)? {
if !stash.contains(&path) {
if !seen.contains(&path) {
walk(&path)?;
}
}
Expand Down

0 comments on commit 0b83e92

Please sign in to comment.