mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +00:00
code_review: PR #1103
Since we only use `$GIT_COMMON_DIR` in filesystem watcher, it is unnecessary to store this value in `Repository`, and we can query the `$GIT_COMMON_DIR` only when it looks like a worktree Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
cea8a90680
commit
b4ab4afd3a
4 changed files with 16 additions and 17 deletions
|
@ -3,8 +3,7 @@
|
|||
public interface IRepository
|
||||
{
|
||||
string FullPath { get; set; }
|
||||
string GitDir { get; set; }
|
||||
string GitCommonDir { get; set; }
|
||||
string GitDirForWatcher { get; }
|
||||
|
||||
void RefreshBranches();
|
||||
void RefreshWorktrees();
|
||||
|
|
|
@ -23,11 +23,8 @@ namespace SourceGit.Models
|
|||
_wcWatcher.Deleted += OnWorkingCopyChanged;
|
||||
_wcWatcher.EnableRaisingEvents = true;
|
||||
|
||||
// If this repository is a worktree repository, just watch the main repository's gitdir.
|
||||
var repoWatchDir = _repo.GitCommonDir.Replace("\\", "/");
|
||||
|
||||
_repoWatcher = new FileSystemWatcher();
|
||||
_repoWatcher.Path = repoWatchDir;
|
||||
_repoWatcher.Path = _repo.GitDirForWatcher;
|
||||
_repoWatcher.Filter = "*";
|
||||
_repoWatcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.DirectoryName | NotifyFilters.FileName;
|
||||
_repoWatcher.IncludeSubdirectories = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue