pub struct ProjectRepo { /* private fields */ }Expand description
The work tree holding a project folder. Its folders are spelled like the
folder it was discovered from: git2 reports resolved paths (symlinks
such as macOS /var, Windows 8.3 short names expanded), and files the
caller reads or writes through Fs stay under the spelling it uses.
Implementations§
Source§impl ProjectRepo
impl ProjectRepo
Sourcepub fn discover(root: &Path) -> Result<Option<Self>, CoreError>
pub fn discover(root: &Path) -> Result<Option<Self>, CoreError>
The repository whose work tree holds root; None when there is no
repository there or it is bare. Any other failure (a repository git
refuses to open, such as one owned by another user, or a broken
config) is git_error: whether a file is tracked is then unknown.
Sourcepub fn relative(&self, path: &Path) -> Option<String>
pub fn relative(&self, path: &Path) -> Option<String>
path relative to the work tree, /-separated; None when it lies
outside.
Sourcepub fn is_tracked(&self, path: &Path) -> Result<bool, CoreError>
pub fn is_tracked(&self, path: &Path) -> Result<bool, CoreError>
Whether the index holds path (it is tracked).
Sourcepub fn tracks_any_under(&self, path: &Path) -> Result<bool, CoreError>
pub fn tracks_any_under(&self, path: &Path) -> Result<bool, CoreError>
Whether the index holds path or any file below it (a folder with
tracked files).
Sourcepub fn is_ignored(&self, path: &Path) -> Result<bool, CoreError>
pub fn is_ignored(&self, path: &Path) -> Result<bool, CoreError>
Whether the repository’s ignore rules match path.
Sourcepub fn exclude_file(&self) -> PathBuf
pub fn exclude_file(&self) -> PathBuf
info/exclude of the repository. Linked work trees share the one in
the common directory.
Sourcepub fn state_files(&self, path: &Path) -> Vec<PathBuf>
pub fn state_files(&self, path: &Path) -> Vec<PathBuf>
The files whose content ProjectRepo::is_tracked and
ProjectRepo::is_ignored of path depend on: the index,
info/exclude and the .gitignore of each folder from the work
tree root down to path’s (git’s global excludes file aside).