Skip to main content

Module lfs

Module lfs 

Source
Expand description

Git LFS pointer support with XET storage backend

This module provides complete LFS handling for git2db:

  • Pointer parsing (spec-compliant, supports legacy hawser version)
  • File loading with automatic pointer detection
  • Worktree scanning and batch processing
  • SHA256 validation (defense in depth against XET CAS bugs)

§Architecture

Application → git2db::lfs::LfsStorage → git2db::xet::XetStorage
                                      → git-xet-filter (XET only)

§Example

ⓘ
use git2db::lfs::{LfsStorage, is_lfs_pointer};

// Initialize LFS storage
let config = git2db::XetConfig::default();
let storage = LfsStorage::new(&config).await?;

// Load file with automatic pointer detection
let data = storage.load_file(&path).await?;

// Or parse and smudge manually
if is_lfs_pointer(&content) {
    let pointer = storage.parse_lfs_pointer(&content)?;
    let data = storage.smudge_lfs_pointer(&pointer).await?;
}

Structs§

LfsPointer
Parsed Git LFS pointer with spec-compliant fields
LfsStorage
Complete LFS storage operations
ProcessingStats
Processing statistics for batch operations

Constants§

XET_MERKLE_EXT_KEY
Well-known LFS pointer extension key carrying the XET MerkleHash (BLAKE3 keyed with DATA_KEY over the content-defined chunk DAG) for the blob, as a 64-char lowercase hex string. Per the LFS spec, unknown extension lines are ignored by vanilla git-lfs clients, so this rides the existing extensions map without breaking back-compat. See issue #386.
XET_SHARD_EXT_KEY
Well-known LFS pointer extension key carrying an opaque shard/cas-location hint (e.g. a shard index or replication-group identifier) for the blob. Optional; consumed by smudge code that needs a locality hint beyond the Merkle hash.

Traits§

LfsSmudge
Extension trait for XetStorage - adds LFS capabilities

Functions§

is_lfs_pointer
Check if content is a Git LFS pointer file