Expand description
Scanner: walk git history, find LFS pointer blobs.
This is the entry point used by git lfs fetch/pull/push to
enumerate the LFS pointers reachable from a set of refs. The pipeline
mirrors upstream:
rev_listemits every reachable object (commits, trees, blobs).CatFileBatchCheckfilters those to blobs whose size could fit in a pointer file (≤MAX_POINTER_SIZE). Blobs are read from index; cheap header-only check, no content I/O.CatFileBatchreads the surviving candidates’ content. Each is parsed as aPointer; non-pointers are silently skipped.- The output is deduplicated by LFS OID (the pointer’s content OID, not the git blob OID): the same LFS object can appear in many blobs/paths, but we only need to fetch it once.
Structs§
- Pointer
Entry - One LFS pointer discovered by the scanner.
- Tree
Blob - One blob found while walking a tree, before any pointer-parsing or
size-based filtering. Paths and OIDs are reported verbatim from
git ls-tree.
Functions§
- scan_
index_ lfs - Scan the index for LFS pointers via
git ls-files --stage -z -- :(attr:filter=lfs). - scan_
index_ pointers - LFS pointers in the index or working tree that differ from
ref(typicallyHEAD). Mirrors upstream’slfs/gitscanner_index.go:: scanIndex: runsgit diff-index <ref>andgit diff-index --cached <ref>to surface staged + working-tree changes, then dedupes by (sha, path). - scan_
pointers - Walk history reachable from
includeminusexclude, return unique LFS pointers. - scan_
pointers_ with_ args scan_pointerswith extra rev-list cmdline args. Seerev_list_with_args.- scan_
previous_ versions - Walk
git log -G "oid sha256:" -p <ref>sincesince, returning every LFS pointer that appears as the previous state of a modified file (i.e. lives on the-side of a unified diff). - scan_
stashed - LFS pointers reachable from
refs/stashand its associated WIP / index / untracked merge parents. Mirrors upstream’slfs/gitscanner_log.go::scanStashed. - scan_
tree - Walk the tree at
reference, returning one entry per LFS pointer blob. - scan_
tree_ blobs - Walk the tree at
referenceand return every blob — no size filter, no pointer parsing. Used byfsck --pointersfor its full-tree sweep when classifying paths against.gitattributes.