Expand description
B3: repository discovery, in one place.
Every magit mode needs “where is the repository”, and every one of
them spelled it out — eleven copies of
Repository::discover(…).ok().and_then(|r| r.workdir().map(…)).
This is not tidying. gix::discover takes a directory, and
passing it a file path fails silently: discover returns Err, the
.ok() swallows it, and the caller gets a default. MG.11 found
three sites doing exactly that, one of them in lattice-host’s
auto-head-diff subsystem — which meant gutter diff signs had never
worked, for any file, since they landed. Two functions, one per
question, make that mistake unrepresentable: a caller with a file
path cannot reach the directory-taking one.