The first parent directory of a path in `paths` that is itself a path in `others`.
(
paths: &std::collections::BTreeSet<&'a str>,
others: &std::collections::BTreeSet<&'a str>,
)
| 1015 | /// The first parent directory of a path in `paths` that is itself a path in |
| 1016 | /// `others`. |
| 1017 | fn parent_directory_among<'a>( |
| 1018 | paths: &std::collections::BTreeSet<&'a str>, |
| 1019 | others: &std::collections::BTreeSet<&'a str>, |
| 1020 | ) -> Option<&'a str> { |
| 1021 | paths.iter().find_map(|path| { |
| 1022 | path.match_indices('/') |
| 1023 | .map(|(end, _)| &path[..end]) |
| 1024 | .find(|parent| others.contains(parent)) |
| 1025 | }) |
| 1026 | } |
| 1027 | |
| 1028 | /// Why recording this turn would NOT reproduce `commit` exactly, or `None` |
| 1029 | /// when it would (CB-12A follow-up AC-8). |
no test coverage detected