mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-08-24 20:34:05 +02:00
Scope Git watching and status to the sync directory (#503)
This commit is contained in:
@@ -6,6 +6,7 @@ use std::path::{Path, PathBuf};
|
||||
pub struct GitRepositoryPaths {
|
||||
pub workdir: PathBuf,
|
||||
pub gitdir: PathBuf,
|
||||
pub commondir: PathBuf,
|
||||
}
|
||||
|
||||
pub(crate) fn open_repo(dir: &Path) -> crate::error::Result<git2::Repository> {
|
||||
@@ -22,7 +23,13 @@ pub fn git_repository_paths(dir: &Path) -> Result<GitRepositoryPaths> {
|
||||
.workdir()
|
||||
.ok_or_else(|| Error::GenericError("Git repository does not have a worktree".into()))?
|
||||
.to_path_buf();
|
||||
Ok(GitRepositoryPaths { workdir, gitdir: repo.path().to_path_buf() })
|
||||
Ok(GitRepositoryPaths {
|
||||
workdir,
|
||||
gitdir: repo.path().to_path_buf(),
|
||||
// Same as gitdir except for linked worktrees, where shared refs and
|
||||
// packed-refs live in the main repository's git directory
|
||||
commondir: repo.commondir().to_path_buf(),
|
||||
})
|
||||
}
|
||||
|
||||
pub fn git_path_is_ignored(dir: &Path, rela_path: &Path) -> Result<bool> {
|
||||
|
||||
Reference in New Issue
Block a user