171. git core plumbing: version control on a nife host with no new primitive
The first of four milestones answering calef's self-hosting question: "how could I shift nife development onto a nife host, so that would have me using nife daily." They are split by tractability rather than proposed as one undertaking; this is the piece that needs the least.
Software-only. Informed by milestone 169 (kilo, the first
real C program against DECISIONS §31's seam) but not
hard-gated on it. Git core needs the identical seam pattern kilo proves, not the terminal
raw-input primitive kilo exists to build, so the two can proceed in parallel.
What "git core" means here, precisely
Checked against git's own architecture, not folklore: the object database (.git/objects, content-
addressed blobs/trees/commits), ref updates (.git/refs, .git/HEAD), and the index file are all
direct file I/O with no subprocess involved. init, add, commit, diff, log, branch,
and checkout need zero fork/exec in a default configuration. Everything that does spawn a
process is opt-in and off by default: the pager (core.pager, off with --no-pager), hooks (none
unless installed), textconv filters, credential helpers, and external diff/merge tools. Git is
normally static-linkable, with no hard threading requirement for these operations.
This milestone is exactly that surface: the plumbing and the porcelain built directly on it,
scoped to local, single-repository, no-subprocess operation. Not in scope: anything that shells out
by design (hooks, external merge drivers). Also anything that needs the network (clone/fetch/
push over a wire protocol, which is a separate milestone's problem, likely shared with
milestone 174 (a thin development client)'s remote-build work once that exists).
What it needs
- The same DECISIONS §31 treatment as
kilo: git's C source rewritten against nife's Rust-mediated shim rather than making system calls directly, scoped to the no-subprocess plumbing above. - Capability-scoped file I/O in place of git's usual global-path assumptions, the same translation
every C port on nife needs (
files.c-shaped work, matching how milestone 169's own scoping section describeskilo's file handling). - Nothing from milestone 169's raw-terminal-input primitive: git's core commands are not a screen
editor, they read arguments and print output through the existing
OPERATION_WRITEANSI-passthrough path (DECISIONS §21).
Why it matters
Directly: it is the second piece, after an editor, of "edit and version-control natively on a nife host," which is the load-bearing precondition for milestone 174's thin-development-client path, the nearer-term alternative to full local self-hosting (milestone 173).
Indirectly: git is the second real, non-editor C program to prove the §31 seam holds for something with real users depending on correctness (a corrupted object database is a worse failure than a cosmetic editor bug). That is evidence worth having before larger C/C++ ports (milestone 172 (a capability-native subprocess primitive), 173) are attempted.
What this does not decide
Whether clone/fetch/push (needing a network client, and eventually
DECISIONS §31-shaped work over whatever wire protocol)
are folded into this milestone or left for whoever builds milestone 174's remote-development
protocol, since the two may end up sharing a network-client crate. Left for whoever picks this up.
Done when
§297 (a package jig installs) binds this. calef, 2026-10-12 (UTC): "They should all be installed
via jig through basalt."
git must run on nife installed by jig install from basalt's package index. basalt builds the
package against the nife commit it pins. The install waits on milestones 809 and 801, as §297 (a
package jig installs) lists. No work toward that starts until those milestones land
(the package manager holds the rule).
Index row
The second of four self-hosting milestones from calef's own question about developing nife on a
nife host. Git's object database, refs and index are direct file I/O with no subprocess involved
by default; init/add/commit/diff/log/branch/checkout need zero fork/exec. Nano-class
DECISIONS §31 work, no new kernel primitive.