restrict case-folding to windows

This commit is contained in:
llama 2025-11-18 22:14:00 +08:00
parent a929a133d6
commit aad01d904f
No known key found for this signature in database
GPG key ID: 0B7543854B9413C3

View file

@ -21,10 +21,14 @@ pub mod changetracker;
pub struct Checksums(HashMap<String, Sha1Hash>);
impl Checksums {
// case-fold filenames when checking files to be imported
// to account for case-insensitive filesystems
pub fn get(&self, key: impl AsRef<str>) -> Option<&Sha1Hash> {
self.0.get(key.as_ref().to_lowercase().as_str())
if cfg!(windows) {
// case-fold filenames when checking files to be imported
// to account for case-insensitive filesystems
self.0.get(key.as_ref().to_lowercase().as_str())
} else {
self.0.get(key.as_ref())
}
}
pub fn contains_key(&self, key: impl AsRef<str>) -> bool {