caio.co/de/caca


Add a little footer 💬 by Caio 4 weeks ago (log)
And nobody cares about meta tags anymore

That's right I got a floor, so what

Tree


caio's code asylum

caca - web front end for git repositories

why

It all started with me trying to understand how git log -- somefile was picking commits and still feeling confused after reading the docs (search for "A more detailed explanation follows", it's well written). So I picked up gix to hack my own file history walker and, well, here we are...

usage

caca [-c /path/to/config] /path/to/gitroot

The (optional) configuration maps a gitconfig/ini file to a GlobalConfig instance. See caio.co/de's live config as an example.

You can use the RUST_LOG environment variable to configure logging. The cmdline I tend to use when hacking is something like:

RUST_LOG=debug cargo watch --ignore '*.html' -x "run ."

features

ideas

warts

the code

There are 2 crates:

When caca starts, it builds an in-memory snapshot of every repository it finds by traversing a base directory (optionally filtering for git-daemon-export-ok) and uses this information to answer most simple requests (listing, main repository pages and feeds)

There's a single admin (caca::admin) actor that manages the snapshots and whenever a change happens within a repository the actor regenerates the snapshot and submits it to the client (caca::client)

The client is responsible for matching requests (is the repository name correct? branch name valid?) and routing accordingly. It makes use of the "business logic" within caca::repo to craft the responses

Repository changes are detected by relying on git's post-update hook being called: git update-server-info outputs a file that caca can watch for changes ($GIT_DIR/info/refs). Alternatively, there's a rudimentary admin web "api" that can be used to trigger manual updates via http

alternatives

If this model is not to your liking: there are really good CGI-based (cgit, cgit-pink, gitweb) and static files (stagit) alternatives; And if you'd like a server, just not this one, I'm aware of gitiles: I never operated it, but it looks great and the goals are quite similar to this one

license

This software is licensed under the European Union Public License (EUPL) v. 1.2 only