Fix cache invalidation for nested pyproject.toml files (#12727)

This commit is contained in:
Micha Reiser 2024-08-07 21:53:45 +02:00 committed by GitHub
parent f34b9a77f0
commit a631d600ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -156,9 +156,16 @@ impl<'a> Resolver<'a> {
.insert(format!("{path}/{{*filepath}}"), self.settings.len() - 1)
{
Ok(()) => {}
Err(InsertError::Conflict { .. }) => {}
Err(InsertError::Conflict { .. }) => {
return;
}
Err(_) => unreachable!("file paths are escaped before being inserted in the router"),
}
// Insert a mapping that matches the directory itself (without a trailing slash).
// Inserting should always succeed because conflicts are resolved above and the above insertion guarantees
// that the path is correctly escaped.
self.router.insert(path, self.settings.len() - 1).unwrap();
}
/// Return the appropriate [`Settings`] for a given [`Path`].