pub struct GitWatcher { /* private fields */ }Expand description
Watches a git repository for changes.
Uses polling-based approach with git2 for efficient status checks.
Implementations§
Source§impl GitWatcher
impl GitWatcher
Sourcepub fn new(repo_path: impl Into<PathBuf>) -> Self
pub fn new(repo_path: impl Into<PathBuf>) -> Self
Create a new watcher for the given repository path.
Sourcepub fn with_config(
repo_path: impl Into<PathBuf>,
config: GitWatcherConfig,
) -> Self
pub fn with_config( repo_path: impl Into<PathBuf>, config: GitWatcherConfig, ) -> Self
Create with custom configuration.
Sourcepub fn should_poll(&self) -> bool
pub fn should_poll(&self) -> bool
Check if it’s time to poll again.
Sourcepub fn cached_snapshot(&self) -> &GitChangeSnapshot
pub fn cached_snapshot(&self) -> &GitChangeSnapshot
Get the cached snapshot (may be stale).
Sourcepub fn poll(&mut self) -> Result<&GitChangeSnapshot>
pub fn poll(&mut self) -> Result<&GitChangeSnapshot>
Poll for changes, returning the current snapshot.
This is rate-limited by min_poll_interval. If called too frequently,
returns the cached snapshot.
Sourcepub fn force_poll(&mut self) -> Result<&GitChangeSnapshot>
pub fn force_poll(&mut self) -> Result<&GitChangeSnapshot>
Force fetch changes regardless of rate limiting.