(
tree: &mut InMemoryIndexTree,
entry: &IndexEntryObservation,
mode: CanonicalTreeMode,
)
| 1046 | } |
| 1047 | |
| 1048 | fn insert_index_tree_entry( |
| 1049 | tree: &mut InMemoryIndexTree, |
| 1050 | entry: &IndexEntryObservation, |
| 1051 | mode: CanonicalTreeMode, |
| 1052 | ) -> Result<(), ()> { |
| 1053 | let path = if mode.is_tree() { |
| 1054 | entry.path.strip_suffix(b"/").unwrap_or(&entry.path) |
| 1055 | } else { |
| 1056 | &entry.path |
| 1057 | }; |
| 1058 | if path.is_empty() || path.contains(&0) { |
| 1059 | return Err(()); |
| 1060 | } |
| 1061 | let components = path.split(|byte| *byte == b'/').collect::<Vec<_>>(); |
| 1062 | if components.iter().any(|component| component.is_empty()) { |
| 1063 | return Err(()); |
| 1064 | } |
| 1065 | insert_index_tree_components(tree, &components, entry.oid, mode) |
| 1066 | } |
| 1067 | |
| 1068 | fn insert_index_tree_components( |
| 1069 | tree: &mut InMemoryIndexTree, |
no test coverage detected