Resolve cache-dir relative to project root (#7962)

## Summary

Unlike other filepath-based settings, the `cache-dir` wasn't being
resolved relative to the project root, when specified as an absolute
path.

Closes https://github.com/astral-sh/ruff/issues/7958.
This commit is contained in:
Charlie Marsh 2023-10-14 15:00:23 -04:00 committed by GitHub
parent e261eb7461
commit 8061894af6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -377,7 +377,7 @@ impl Configuration {
.cache_dir
.map(|dir| {
let dir = shellexpand::full(&dir);
dir.map(|dir| PathBuf::from(dir.as_ref()))
dir.map(|dir| fs::normalize_path_to(dir.as_ref(), project_root))
})
.transpose()
.map_err(|e| anyhow!("Invalid `cache-dir` value: {e}"))?,