A successful git push is a small promise. Somewhere on another machine, a branch now points at the commit you sent. The next person can fetch it. If the server process dies a moment later, the commit is still there.
That was the promise we wanted Dengel Git to keep. We started with three ordinary commands on a real machine. Clone, fetch and push. We spent most of our time on what could happen between that last command and the line that says it worked.
Why Rust in the first place?
Dengel was already a Rust project. The question was how much of Git we could implement there and verify ourselves. We started with a time-boxed experiment on packfiles, the compressed bundles Git uses to store and transfer objects. Could we read a real pack, reconstruct the objects inside it, write a pack of our own, and get stock Git to accept it? We gave ourselves two evenings and a weekend day.
The pack experiment passed the correctness tests. Our delta compression fell short of the pack-size target, which was useful to know while the project was still small. We tried fetch negotiation next. A pack is a file you can inspect after the fact. A fetch is a conversation, and the next message depends on what both sides already know. Then came the ref store, where we had to find out what happens when two people update the same branch or the process dies halfway through a write. Git’s pack format · Git protocol v2
Rust gave us a practical way to carry the experiments into the service. The HTTP handler could call the same Rust code we were testing for object validation and ref updates. At the network boundary, we used Result so the parser could report a malformed or incomplete pack and the server could refuse the push. The types helped us make that path explicit. To find out whether a ref update survived a killed process, we still had to kill the process. Rust’s error-handling model
What we meant by a clean room
We kept a separate Git checkout for reference. The C implementation was off limits, including for a quick look when we got stuck. We could read Git’s technical documentation, the mailing list and public specifications. We could run stock Git, give it fixtures and inspect what it produced. The first experiment even had a stop condition for the moment we felt we needed to open the C source.
We also kept a log of what we were relying on. If a detail came from prior knowledge and we couldn’t point to a reference, it went in the notes. That mattered with coding agents. A model can sound quite certain about a byte layout or a filesystem guarantee. We wanted a reference or a test we could rerun.
My favourite example is a test for Git’s directory listings. Git calls one of those listings a tree. Each entry names a file or a subdirectory. An empty listing has zero bytes of contents, and Git still gives it an object ID by hashing a header that says what it is and how big it is.
Our parser was looking at just the contents, and our test expected it to reject zero bytes. So we asked stock Git to create an empty tree. Git gave us an object ID, and when we read the tree back, the listing was empty. The parser had been right all along. We changed the test.
Six steps, two places to slow down
The first step was the object model. Blobs hold file contents, trees hold directory entries, and commits and tags point to other objects. We read the links we need and preserve the original bytes. Even tidying up a historical spelling of a file mode could change the object ID. Git gives you plenty to think about before you open a socket.
Packs came second. Stock Git had to accept the packs we wrote with git index-pack --strict. Third came reads. We started over standard input and output so we could test the protocol in isolation, then added smart HTTP. An ordinary Git client could now clone a repository from the server and run git fsck on the result.
The next two steps got most of the attention. First, the ref store. A ref is a name like refs/heads/main that points at an object. When a writer asks the server to move a ref, it supplies the value it expects to find there. If another writer has already moved it, we can refuse the stale update and preserve the work that arrived in the meantime.
Second, receiving pushes. Incoming objects go into a temporary quarantine. We check the pack and the objects inside it, then follow the links from each proposed tip to make sure its history and file contents are present. Once those checks pass, we publish the pack and attempt the ref transaction. The client gets a success response after the ref transaction commits.
The sixth step was to run it on a real machine. We used Dengel Git as a second remote for our own repository so we could push real history, clone it back and compare what came out.
We let Git grade our homework
The implementation and the tests had separate jobs. Stock Git created reference repositories and produced the expected results. The tests started the compiled Rust server as a subprocess and used the same interfaces a client would. We gave fixtures fixed authors and timestamps so we could compare exact object IDs.
For a clone, we checked branch tips, annotated tags and repository integrity. For an incremental fetch, we gave one checkout commits the server had never seen and checked what it fetched alongside what it already knew. For a partial clone, we left a file object out, asked Git to read it later, and checked the bytes that came back.
For refs, we made two writers race for the same branch. Both started with the same old commit ID. Exactly one had to win. Two writers updating different refs had to be able to finish. We also tested a batch with one stale ref, where the whole batch had to be refused.
Then we killed the process. The harness paused the writer at explicit checkpoints, such as after writing into quarantine, after publishing the pack and around the ref update. We could test both sides of a write boundary without hoping a sleep would land at the right moment. After the kill, we inspected the refs and objects with stock Git and tested a retry from a fresh client. If the server had acknowledged a push, the change had to be there. These were process-crash tests. A host losing power is a different test.
The clone worked. The repository was broken.
One of the better lessons came from a push of 121 commits of real history. An early build accepted the push. The repository still served clones. Then git fsck reported 545 delta-base validation errors.
Git can send a thin pack when it knows the server already has some of the objects. A delta in that pack might describe the difference from an object in an older pack on the server. That saves bytes on the wire. We could resolve those bases while reading the push, but we were storing the incoming pack as received. The pack on disk still depended on objects it didn’t contain. Git’s pack format
We changed the receive path to write a self-contained pack from the objects we had decoded. That meant giving up the incoming delta compression at that point. It can cost more disk space, and the objects can be repacked later. First we needed the repository to pass fsck. Also, we needed to remember to run fsck on the server’s repository. A clone could look perfectly happy while the source still had a problem.
What passed
In the November verification run, the Linux gate passed 437 Git tests, including concurrent ref updates and interrupted-push recovery. Three latency tests were skipped. In a separate smoke test with stock Git 2.50, we cloned, pushed a branch and an annotated tag, and fetched the change from a second checkout. Shallow clone worked, as did partial clone with an on-demand blob fetch. Both client and server repositories passed strict git fsck.
We also cloned the public production canary anonymously and checked its exact landed commit and history. The public receipt identifies the candidate that was checked and the commit that landed. Those are two useful things to be able to look up when a push is part of a review workflow. Public Git canary · Signed Guard receipt
There’s more work on large pushes. The receive path we tested still buffers packs, and a process interrupted after pack publication can leave unreferenced objects to clean up. We want measured memory limits and repeatable recovery on larger repositories before making claims about either.
Anyhow, if you’re testing a Git server, put a second checkout in the test. The one that did the push already has all your files.

