Support the COMMON_PATH variant of the event summariser

This commit is contained in:
Félix Saparelli 2021-10-16 16:54:48 +13:00
parent 30abed3fb2
commit 5d2f2fcf62
No known key found for this signature in database
GPG key ID: B948C4BAE44FC474

View file

@ -115,10 +115,19 @@ where
_ => "OTHERWISE_CHANGED",
}))
.or_insert_with(Vec::new)
.extend(paths.into_iter().map(|p| p.into_os_string()));
.extend(paths.into_iter().map(|p| {
if let Some(suffix) = common_path
.as_ref()
.and_then(|prefix| p.strip_prefix(prefix).ok())
{
suffix.as_os_str().to_owned()
} else {
p.into_os_string()
}
}));
}
grouped_buckets
let mut res: HashMap<&'static OsStr, OsString> = grouped_buckets
.into_iter()
.map(|(kind, paths)| {
let mut joined =
@ -133,5 +142,11 @@ where
(kind, joined)
})
.collect()
.collect();
if let Some(common_path) = common_path {
res.insert(OsStr::new("COMMON_PATH"), common_path.into_os_string());
}
res
}