Rust · content-addressed · git-shaped
Timelace is a tiny content-addressed version control system in Rust, small enough to read in one sitting. Blobs, trees, and commits, each one addressed by the SHA-256 hash of its own bytes. Here is the real object model, running in your browser.
Add a file, then add another with identical content and compare blob ids below.
| Name | Content | Blob id |
|---|
A commit hashes a tree of the working files above, plus the current HEAD as its parent.
HEAD
(no commits yet)
Walked from HEAD by following each commit's parent link. Check out an earlier commit to restore its snapshot into the working files above.
Every blob, tree, and commit ever created in this session, addressed only by the hash of its own bytes. Identical blob content always lands on the same id, so it is stored once.
real SHA-256 hashing, in your browser, nothing touches a network
Every object's name is a hash of its own content. That single rule is what makes content addressing work, and it is the entire idea Timelace is built to make visible.
The bytes of one file, nothing else. Two files with identical content share one blob, automatically.
Names mapped to blob or tree ids, sorted before hashing so identical contents always produce the same id.
A tree id, an optional parent, a message, and a timestamp. Follow parent links to walk the whole history.
The full workflow, initialize a repository, stage a file, commit it, and check it back out.
$ timelace init
initialized empty timelace repository in ./.timelace
$ echo "hello" > notes.txt
$ timelace add notes.txt
$ timelace commit -m "first commit"
committed 4b7b6338afbc1a9b9b0fbaae5866a8483f70ec56f0d0b2630e4955788624edc9
$ timelace log
commit 4b7b6338afbc1a9b9b0fbaae5866a8483f70ec56f0d0b2630e4955788624edc9
timestamp 1787349600
first commit
$ timelace checkout 4b7b6338afbc1a9b9b0fbaae5866a8483f70ec56f0d0b2630e4955788624edc9
Objects live in a two-level directory split by the first two characters of their id, the same trick git uses to keep any one directory small.
Not a git replacement. A way to actually see how content-addressed version control works, with no packfiles, no plumbing and porcelain split, no thousands of files standing between you and the idea. Read src/objects.rs and you have read the whole model.
Source, tests, and design notes are public on GitHub. The object model, the on-disk layout, and the commit and checkout algorithms are documented in DESIGN.md.