(
repo: &Repository,
working_copy: WorkingCopyId,
git: &GitRepository,
)
| 2756 | } |
| 2757 | |
| 2758 | pub(crate) fn current_heads( |
| 2759 | repo: &Repository, |
| 2760 | working_copy: WorkingCopyId, |
| 2761 | git: &GitRepository, |
| 2762 | ) -> CliResult<ShimSnapshot> { |
| 2763 | let head = git |
| 2764 | .head() |
| 2765 | .map_err(|error| git_error(format!("Git HEAD is unavailable: {error}")))?; |
| 2766 | let oid = head |
| 2767 | .target() |
| 2768 | .ok_or_else(|| git_error("Git HEAD does not point directly to a commit"))?; |
| 2769 | let tree = head |
| 2770 | .peel_to_commit() |
| 2771 | .and_then(|commit| commit.tree()) |
| 2772 | .map_err(|error| git_error(format!("cannot read Git HEAD tree: {error}")))?; |
| 2773 | let view = repo |
| 2774 | .desired_view_name(working_copy) |
| 2775 | .map_err(CliError::from)?; |
| 2776 | let atomic_state = repo |
| 2777 | .get_view_info(&view) |
| 2778 | .map_err(CliError::from)? |
| 2779 | .state |
| 2780 | .to_string(); |
| 2781 | Ok(ShimSnapshot { |
| 2782 | view, |
| 2783 | atomic_state, |
| 2784 | git_head: oid.to_string(), |
| 2785 | git_tree: tree.id().to_string(), |
| 2786 | }) |
| 2787 | } |
| 2788 | |
| 2789 | pub(crate) fn read_checkpoint_observation( |
| 2790 | root: &Path, |
no test coverage detected