pub enum Path {
LinkedWorkTree {
work_dir: PathBuf,
git_dir: PathBuf,
},
WorkTree(PathBuf),
Repository(PathBuf),
}
Expand description
A repository path which either points to a work tree or the .git
repository itself.
Variants§
LinkedWorkTree
The currently checked out linked worktree along with its connected and existing git directory, or the worktree checkout of a submodule.
Fields
WorkTree(PathBuf)
The currently checked out or nascent work tree of a git repository
Repository(PathBuf)
The git repository itself, typically bare and without known worktree. It could also be non-bare with a worktree configured using git configuration, or no worktree at all despite not being bare (due to mis-configuration for example).
Note that it might still have linked work-trees which can be accessed later, bare or not, or it might be a
submodule git directory in the .git/modules/**/<name>
directory of the parent repository.
Implementations§
source§impl Path
impl Path
sourcepub fn from_dot_git_dir(
dir: PathBuf,
kind: Kind,
current_dir: &Path,
) -> Option<Self>
pub fn from_dot_git_dir( dir: PathBuf, kind: Kind, current_dir: &Path, ) -> Option<Self>
Instantiate a new path from dir
which is expected to be the .git
directory, with kind
indicating
whether it’s a bare repository or not, with current_dir
being used to normalize relative paths
as needed.
None
is returned if dir
could not be resolved due to being relative and trying to reach outside of the filesystem root.
sourcepub fn into_repository_and_work_tree_directories(
self,
) -> (PathBuf, Option<PathBuf>)
pub fn into_repository_and_work_tree_directories( self, ) -> (PathBuf, Option<PathBuf>)
Consume and split this path into the location of the .git
directory as well as an optional path to the work tree.
Trait Implementations§
source§impl Ord for Path
impl Ord for Path
source§impl PartialOrd for Path
impl PartialOrd for Path
impl Eq for Path
impl StructuralPartialEq for Path
Auto Trait Implementations§
impl Freeze for Path
impl RefUnwindSafe for Path
impl Send for Path
impl Sync for Path
impl Unpin for Path
impl UnwindSafe for Path
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)