Expand description
Git integration for change tracking Git integration for change-aware index updates
This module provides git-based change detection to enable 10-100x faster incremental index builds by processing only files that have changed since the last index build.
§Architecture
The module uses a trait-based design to support multiple backends:
SubprocessGit: Subprocess-based git command execution (current)NoGit: Fallback when git is unavailable (always returns empty changes)- Future:
Git2Backendfor libgit2-based implementation (enterprise)
§Security
- All git commands use
Command::new("git")with array arguments (no shell) - File paths are canonicalized and validated to remain under workspace root
- Environment variables are validated and clamped to safe ranges
- Git command output is limited to 10MB to prevent memory exhaustion
- Timeouts enforce SIGTERM then SIGKILL process cleanup
§Example
use sqry_core::git::{GitChangeTracker, ChangeSet};
use std::path::Path;
let workspace = Path::new("/path/to/repo");
let mut tracker = GitChangeTracker::new(workspace)?;
// Detect changes since last indexed commit
let baseline = Some("abc123");
let (changes, new_head) = tracker.detect_changes(baseline)?;
println!("Changed files: {}", changes.total());
println!("New HEAD: {:?}", new_head);Re-exports§
pub use recency::RecencyIndex;
Modules§
- recency
- Recency scoring for hybrid search based on git commit timestamps
Structs§
- Change
Set - Represents a set of file changes detected by git
- GitCapabilities
- Backend-specific capabilities
- GitChange
Tracker - High-level facade for git change tracking
- NoGit
- No-op git backend that always reports no changes
- Subprocess
Git - Subprocess-backed git integration
- Worktree
Manager - Manages temporary git worktrees with RAII cleanup guarantees.
Enums§
- GitError
- Errors that can occur during git operations
Traits§
- GitBackend
- Git backend abstraction for change detection
Functions§
- max_
git_ output_ size - Get maximum git output size, respecting environment variable override
- parse_
diff_ name_ status - Parse
git diff --name-status -zoutput - parse_
porcelain - Parse
git status --porcelain=v1 -zoutput
Type Aliases§
- Result
- Result type for git operations