pub struct RepositoryIdentity { /* private fields */ }Expand description
The repository a command is operating on, and every work tree git has registered for it.
Built once per command and passed around. A handful of subprocesses go into it and no
more: the identity questions, one worktree list, and the trunk lookups.
Implementations§
Source§impl RepositoryIdentity
impl RepositoryIdentity
Sourcepub fn discover(start: &Path) -> Result<Self>
pub fn discover(start: &Path) -> Result<Self>
Resolve the repository from any directory inside any of its work trees.
Sourcepub fn refresh(&mut self) -> Result<()>
pub fn refresh(&mut self) -> Result<()>
Re-read the registered work trees. Under the lock, before a mutation, because the topology may have changed since discovery.
Sourcepub fn git_common_dir(&self) -> &ResolvedPath
pub fn git_common_dir(&self) -> &ResolvedPath
The common git directory every work tree of this repository shares. It is the repository’s identity: two paths belong to one repository exactly when this matches.
Sourcepub fn primary_worktree(&self) -> &ResolvedPath
pub fn primary_worktree(&self) -> &ResolvedPath
The primary checkout — the main work tree, never a linked one, whatever directory the command was run from.
Sourcepub fn current_worktree(&self) -> &ResolvedPath
pub fn current_worktree(&self) -> &ResolvedPath
The work tree the command was run inside.
Sourcepub fn repository_name(&self) -> String
pub fn repository_name(&self) -> String
The primary checkout’s directory name: what the container is named after.
Sourcepub fn registered_worktrees(&self) -> &[WorktreeRecord]
pub fn registered_worktrees(&self) -> &[WorktreeRecord]
Every work tree git has registered, primary first, exactly as the porcelain listed them.
Sourcepub fn is_primary(&self, record: &WorktreeRecord) -> bool
pub fn is_primary(&self, record: &WorktreeRecord) -> bool
Is this record the primary checkout?
Sourcepub fn is_current(&self, record: &WorktreeRecord) -> bool
pub fn is_current(&self, record: &WorktreeRecord) -> bool
Is the command running inside this record’s work tree?
Sourcepub fn current_record(&self) -> Option<&WorktreeRecord>
pub fn current_record(&self) -> Option<&WorktreeRecord>
The record of the work tree the command runs in, when git lists it.
Sourcepub fn record_of_branch(&self, branch: &str) -> Option<&WorktreeRecord>
pub fn record_of_branch(&self, branch: &str) -> Option<&WorktreeRecord>
The record holding a branch, when one does.
Sourcepub fn record_at(&self, path: &ResolvedPath) -> Option<&WorktreeRecord>
pub fn record_at(&self, path: &ResolvedPath) -> Option<&WorktreeRecord>
The record registered at a path, whatever the path is called.
Trait Implementations§
Source§impl Clone for RepositoryIdentity
impl Clone for RepositoryIdentity
Source§fn clone(&self) -> RepositoryIdentity
fn clone(&self) -> RepositoryIdentity
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more