Skip to main content

Module lfs

Module lfs 

Source
Expand description

LFS custom-transfer agent (line-oriented JSON protocol).

Implementation of git-lfs-object-store, the LFS custom-transfer agent for the S3 and Azure Blob backends. The on-bucket layout is <prefix>/lfs/<oid>.

The agent has two modes:

  • Subcommands (install, enable_debug, disable_debug): one-shot CLI calls that mutate the local repo’s git config.
  • Helper REPL (run::run): newline-delimited JSON over stdin/stdout, dispatched per LFS event (init, upload, download, terminate).

Stdout is the wire protocol — see .claude/rules/protocol-stdout.md. Diagnostics use tracing configured to write to stderr (or to a debug log file when invoked with the debug argv slot).

Structs§

GitRemoteResolver
Production resolver: opens the local repo via gix, reads the remote URL, parses it, and builds the matching object-store backend.

Enums§

InstallError
Errors surfaced by the install / debug-toggle subcommands.
RunError
Errors surfaced by run that are fatal to the agent process.

Constants§

AGENT_NAME
Custom-transfer agent name registered with git lfs. The keys lfs.customtransfer.<name>.* are namespaced under this; matches the binary name (git-lfs-object-store).

Traits§

RemoteResolver
How to resolve a remote name to an ObjectStore. Production uses a gix-based resolver; tests inject a closure that returns a MockStore (the in-memory test backend gated on test-util).

Functions§

disable_debug
Inverse of enable_debug: clear lfs.customtransfer.<agent>.args.
enable_debug
Set lfs.customtransfer.<agent>.args = debug so the next time git invokes the agent it forwards the debug argv slot, switching the agent’s logging from stderr to a file in <git-dir>/lfs/tmp/.
install
Register the agent with git lfs in the repository at cwd.
run
Drive the LFS REPL until stdin closes or terminate arrives.