pub enum Worktrees {
Skip,
Include,
}Expand description
Whether a roots scan hosts the linked git worktrees it walks over.
A roots entry is a discovery mechanism, and a second checkout of a
repository you either already have or deliberately did not add is not a
discovery: hosting it presents one repository as N peer projects at N
revisions, which triple-counts its symbols in every metric and lets a
workspace-scoped retrieval return the same file at three revisions as three
independent sources (issue #837).
Deliberately not a bool parameter, and deliberately not defaulted at
this layer: scan_root and discover_repos_under take it by value so that
every one of the nine call sites across the CLI and config resolution has to
state its answer at the call. This rule previously existed in one place and was
read by many, which is the shape that let #806’s five markdown-link scanners and
#787’s two walkers drift; a defaulted argument would restore exactly that — a
new caller inheriting a policy it never considered.
Deliberately not #[non_exhaustive]: the set is closed by the question, not by
today’s implementation. A discovered directory either is hosted or it is not,
and there is no third answer to give — a future “host it but label it as a
worktree of its parent” (issue #837, option 2) is a property of the hosted
project rather than a third outcome of this scan, so it would arrive on
RootScan and leave this pair intact. Closing it lets every caller match both
arms and be told by the compiler when the policy grows a case, which is the
whole reason the parameter is not a bool.
Variants§
Skip
Walk past a linked worktree, recording it in RootScan::worktrees so the
caller can say what it skipped. The default, and what a roots entry gets
unless the workspace declaring it sets include_worktrees = true.
Include
Host a linked worktree as an ordinary member, as every roots scan did
before #837. The opt-in, and what an explicit repos = [...] entry gets by
construction — an explicit path is never discovered, so it never reaches
this scan at all.
Trait Implementations§
impl Copy for Worktrees
impl Eq for Worktrees
Source§impl Ord for Worktrees
impl Ord for Worktrees
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Worktrees
impl PartialOrd for Worktrees
impl StructuralPartialEq for Worktrees
Auto Trait Implementations§
impl Freeze for Worktrees
impl RefUnwindSafe for Worktrees
impl Send for Worktrees
impl Sync for Worktrees
impl Unpin for Worktrees
impl UnsafeUnpin for Worktrees
impl UnwindSafe for Worktrees
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.