Skip to main content

validate_lfs_pointers

Function validate_lfs_pointers 

Source
pub fn validate_lfs_pointers(
    repo_root: &Path,
    files: &[String],
) -> Result<Vec<LfsPointerIssue>>
Expand description

Validates LFS pointer files for correctness.

This function checks if files that should be LFS pointers are valid:

  • Valid LFS pointers start with version <https://git-lfs.github.com/spec/v1>
  • Detects files that should be pointers but contain binary content
  • Detects corrupted pointer files

§Arguments

  • repo_root - Path to the repository root
  • files - List of file paths to validate (relative to repo_root)

§Returns

  • Ok(Vec<LfsPointerIssue>) - List of issues found (empty if all valid)
  • Err(anyhow::Error) - If file reading fails

§Example

use std::path::Path;
use ralph::git::lfs::validate_lfs_pointers;

let issues = validate_lfs_pointers(Path::new("."), &["large.bin".to_string()]).unwrap();
for issue in issues {
    eprintln!("{}", issue.description());
}