More than two years ago I wrote Git Page, a git mirror repository written in Java, that parses the raw git repository directory. Whilst this project was cool, it was too RAM intensive to actually run, had large security issues and would mean making tonnes of changes to make it compatible with upcoming changes to git itself.
I then started using cgit, a CGI script based front-end for mirrored git repositories. This again was cool, but it was still far too heavy for my new server with just 128MB of RAM.
Some time parsed and I wrote some tiny libraries… One as a JSON parser, another as a mini server implementation, another as a git command line wrapper… It turned out I had now implemented enough mini-libraries (from a still-to-be-released project named smol libs).
Using just a tiny JSON parser, a tiny server, a tiny git wrapper and some glue code we have a C implementation of a git server.
The configuration is very simple and is a subset of JSON (very simple architecture, everything is a string). Once you have git clone
’d into the repos/
directory (using HTTPS) you then just update the configuration to point at it, restart the program and off you go.
As you can see, there are quite a few things we can do with regards to viewing repository details. Operations include repository list, repository overview, view repository logs, view repository commits, view repository trees and RSS feeds for new commits.
As you can see, the parsing for the commit logs is not quite right yet, but good enough for now.
We can display the tree architecture, but not display the files themselves just yet. The intention here is just to let the user download the file, although I will need to think of a RAM efficient way of doing this.
Lastly we can get an RSS feed for the given repository, as a mirror of the remote.
It is currently open source, you can see for yourself how ultra small and simple the implementation actually is. Alternatively, you can view it from this server with limited functionality.