docs: fix stale pre-batching pre-commit hook description

The pre-commit hook (installed by rad-heartwood-lfs's `rad lfs init`)
no longer calls `rad lfs store` once per staged file -- it batches
every file into one `rad lfs precommit` call, so a private repo's
passphrase is only prompted for once per commit rather than once per
file. Also note the push gotcha (pushing a commit and pushing its
`refs/notes/rad-lfs` mapping are two separate `git push rad`
invocations) here too, not just in the companion repo's docs.
This commit is contained in:
Maciek "mab122" Bator 2026-07-16 14:39:12 +02:00
parent ac4a27c098
commit fe270dca8f
1 changed files with 10 additions and 7 deletions

View File

@ -17,17 +17,20 @@ once a repository has been set up with `rad lfs init` (from the fork above).
## How it works
Every peer uses their own local IPFS node — there's no shared server. All of the actual
IPFS add/pin work and git-notes bookkeeping (`refs/notes/rad-lfs`) lives in the `rad lfs
store`/`rad lfs fetch` subcommands, implemented in the companion
IPFS add/pin work and git-notes bookkeeping lives in the `rad lfs store`/`rad lfs fetch`/
`rad lfs precommit` subcommands, implemented in the companion
[**radicle-heartwood-lfs**](https://git.hswro.org/mab122/radicle-heartwood-lfs) fork — that's
also where content gets encrypted for private repositories before it ever reaches IPFS. This
crate deliberately has no dependency on Radicle's identity/crypto stack; it just shells out:
- On `git add`/`git commit`, a pre-commit hook (installed by `rad lfs init`) runs `rad lfs
store` on each staged LFS-tracked file, which adds it to your local IPFS daemon, pins it,
encrypts it first if the repo is private, and records the resulting CID as a git note. That
notes ref travels with the repository via Radicle's normal replication, alongside everything
else.
- On `git add`/`git commit`, a pre-commit hook (installed by `rad lfs init`) collects every
staged LFS-tracked file's oid/size and passes them all to a single `rad lfs precommit` call,
which adds each one to your local IPFS daemon, pins it, encrypts it first if the repo is
private, and records the resulting CID as a git note (batched into one call, rather than one
per file, so a private repo's passphrase is only prompted for once per commit). Note that
committing the note locally and pushing it are separate steps in Radicle — pushing your
commit (`git push rad <branch>`) does **not** also push the notes ref; that needs a separate
bare `git push rad` (see radicle-heartwood-lfs's `LFS-IPFS.md` for the full explanation).
- `rad-lfs-transfer` implements the other half: when `git lfs push`/`pull` runs, it's invoked
per-object over stdin/stdout JSON (the standard Git LFS custom-transfer-agent protocol) and:
- **upload**: shells out to `rad lfs store --oid <oid> --size <size> <path>`, which is