(
repo: &Repository,
working_copy: WorkingCopyId,
git: &GitRepository,
)
| 2800 | } |
| 2801 | |
| 2802 | pub(crate) fn current_heads( |
| 2803 | repo: &Repository, |
| 2804 | working_copy: WorkingCopyId, |
| 2805 | git: &GitRepository, |
| 2806 | ) -> CliResult<ShimSnapshot> { |
| 2807 | let head = git |
| 2808 | .head() |
| 2809 | .map_err(|error| git_error(format!("Git HEAD is unavailable: {error}")))?; |
| 2810 | let oid = head |
| 2811 | .target() |
| 2812 | .ok_or_else(|| git_error("Git HEAD does not point directly to a commit"))?; |
| 2813 | let tree = head |
| 2814 | .peel_to_commit() |
| 2815 | .and_then(|commit| commit.tree()) |
| 2816 | .map_err(|error| git_error(format!("cannot read Git HEAD tree: {error}")))?; |
| 2817 | let view = repo |
| 2818 | .desired_view_name(working_copy) |
| 2819 | .map_err(CliError::from)?; |
| 2820 | let atomic_state = repo |
| 2821 | .get_view_info(&view) |
| 2822 | .map_err(CliError::from)? |
| 2823 | .state |
| 2824 | .to_string(); |
| 2825 | Ok(ShimSnapshot { |
| 2826 | view, |
| 2827 | atomic_state, |
| 2828 | git_head: oid.to_string(), |
| 2829 | git_tree: tree.id().to_string(), |
| 2830 | }) |
| 2831 | } |
| 2832 | |
| 2833 | pub(crate) fn read_checkpoint_observation( |
| 2834 | root: &Path, |
no test coverage detected