pub fn diff_base_candidates(root: &Path) -> Vec<PathBuf>Expand description
Directories a supplied unified diff’s paths might be relative to, most
preferred first: the git toplevel above root, then root itself. Only
root outside a git repository or when root is the toplevel.
git diff writes paths relative to the repository toplevel, while
git diff --relative writes them relative to the invoking directory. A
unified diff does not say which one it is, so the caller offers both and the
paths decide (see place_diff). The two coincide for a single-package
repo, and differ when the root addresses a package inside a monorepo.
The toplevel is only used to measure how far root sits below it; the
returned base is that many components popped off root itself, so it keeps
root’s spelling. Finding paths are built from root, and a canonicalized
base would fail to prefix them wherever the two disagree (/tmp vs
/private/tmp on macOS).