| 1473 | |
| 1474 | impl ProspectiveProjectTree { |
| 1475 | fn new(policy: ConversionPolicy, current: Option<ProjectTree>) -> CliResult<Self> { |
| 1476 | let mut manifests = HashMap::new(); |
| 1477 | let entries = if let Some(project) = current { |
| 1478 | let oid = Oid::from_bytes(project.git.root.as_bytes()) |
| 1479 | .map_err(|error| git_error(format!("invalid projected Git tree: {error}")))?; |
| 1480 | let entries = project |
| 1481 | .manifest |
| 1482 | .entries |
| 1483 | .iter() |
| 1484 | .cloned() |
| 1485 | .map(|entry| (entry.path.clone(), entry)) |
| 1486 | .collect(); |
| 1487 | manifests.insert(oid, project); |
| 1488 | entries |
| 1489 | } else { |
| 1490 | BTreeMap::new() |
| 1491 | }; |
| 1492 | Ok(Self { |
| 1493 | policy, |
| 1494 | entries, |
| 1495 | manifests, |
| 1496 | }) |
| 1497 | } |
| 1498 | |
| 1499 | fn apply_commit( |
| 1500 | &mut self, |