Resolves a `worktrees/ ` leaf to `(worktree_root, branch)` by reading its `gitdir` file and the linked HEAD.
(common: &Path, name: &str)
| 710 | /// Resolves a `worktrees/<name>` leaf to `(worktree_root, branch)` by reading |
| 711 | /// its `gitdir` file and the linked HEAD. |
| 712 | fn resolve_worktree(common: &Path, name: &str) -> Option<(PathBuf, String)> { |
| 713 | let wt_meta = common.join("worktrees").join(name); |
| 714 | let gitdir_file = wt_meta.join("gitdir"); |
| 715 | let gitdir_raw = std::fs::read_to_string(&gitdir_file).ok()?; |
| 716 | // `gitdir` points at `<worktree>/.git`; the worktree root is its parent. |
| 717 | let gitdir = PathBuf::from(gitdir_raw.trim()); |
| 718 | let wt_root = gitdir.parent()?.to_path_buf(); |
| 719 | let branch = crate::branch::current_branch(&wt_root)?; |
| 720 | Some((wt_root, branch)) |
| 721 | } |
| 722 | |
| 723 | /// Runs branch-store GC for a project, logging what it removed. |
| 724 | /// |
no test coverage detected