zit 0.3.40 puts line counts in the crosslink stream. A forge can show
"+15 −3" on every check-in and file without running zit diff --numstat
once per check-in.
No artifact, tag namespace, wire, or on-disk repository format changed. The
crosslink record format is still crosslink 1.
Line counts in the crosslink stream
Each file line in zit crosslink is now followed by a line giving what the
file added and removed against the primary parent:
file M src/a.zig
lines 12 3
file A src/b.zig
lines 40 0
file M logo.png
lines - -
- The counts are the ones
zit diff --numstat --checkingives for the same path. Both commands now count with one function, so they cannot disagree. - A binary file is
- -. - A file whose mode alone changed is
0 0.--numstatleaves such a file out, because its text did not change. - An add counts every line as added; a delete counts every line as removed.
- When the store cannot produce a file's content on either side, because the
content was shunned or never fetched into a sparse store, there is no
linesline for that file. Its counts appear once the content arrives. files unknownrecords carry nolineslines.
A consumer that parses only the lines it knows is unaffected: the stream has always promised that a consumer skips a line it does not know.
What it costs
Counting reads both sides of every changed file, so it is kept away from everything else:
- The counts live in a cache file of their own,
.zit-cache/lines, that onlycrosslinkreads or writes. The cache every other command builds on its first open is unchanged, and so is the time it takes. - The first
crosslinkover a long history counts every change once, and takes longer than it used to. Later runs read the stored counts and count only new check-ins. A first run that is cut short keeps what it counted and resumes from there. - A check-in's counts never change once its name is known, so growth of the repository never invalidates them; a shun discards them, since it removes content they were read from.
--no-cachecounts everything afresh and stores nothing, so its output can still be compared byte for byte with the cached run.
Compatibility
zit diff --numstatprints exactly what it printed before.- Existing
crosslinklines are unchanged in content and order; thelineslines are the only addition.
Qualification
zig fmt --check, zig build test, e2e, smoke (19 scenarios),
git-import-e2e, git-export-e2e, dst, and every fuzz target, plus the
three-runner battery.