Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-vcs/src/lib.rs')
| -rw-r--r-- | helix-vcs/src/lib.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/helix-vcs/src/lib.rs b/helix-vcs/src/lib.rs index 4c5f2036..e38cba6f 100644 --- a/helix-vcs/src/lib.rs +++ b/helix-vcs/src/lib.rs @@ -57,6 +57,12 @@ impl DiffProviderRegistry { }) } + pub fn needs_reload(&self, fs_event: &helix_core::file_watcher::Event) -> bool { + self.providers + .iter() + .any(|provider| provider.needs_reload(fs_event)) + } + /// Fire-and-forget changed file iteration. Runs everything in a background task. Keeps /// iteration until `on_change` returns `false`. pub fn for_each_changed_file( @@ -102,6 +108,14 @@ enum DiffProvider { } impl DiffProvider { + pub fn needs_reload(&self, fs_event: &helix_core::file_watcher::Event) -> bool { + match self { + #[cfg(feature = "git")] + DiffProvider::Git => fs_event.path.as_std_path().ends_with(".git/HEAD"), + DiffProvider::None => false, + } + } + fn get_diff_base(&self, file: &Path) -> Result<Vec<u8>> { match self { #[cfg(feature = "git")] |