pub fn resolve_git_common_dir(cwd: &Path) -> Result<PathBuf, ChangedFilesError>Expand description
Resolve the canonical git common directory for cwd.
Runs git rev-parse --path-format=absolute --git-common-dir. Unlike
--show-toplevel (which returns each worktree’s own working directory),
--git-common-dir returns the SHARED .git directory of the repository,
so every linked worktree of the same repo resolves to the SAME path. This
is what lets the Impact store collapse all worktrees of a repo onto a
single identity (one history per repo, not per checkout).
--path-format=absolute (git 2.31+) forces an absolute result, so the
bare-.git relative form --git-common-dir would otherwise emit at the
repo root is avoided. The path is canonicalized to agree with paths from
fs::canonicalize elsewhere (macOS /tmp -> /private/tmp, Windows 8.3).