Last week I hacked a couple new features into
cgit, a web interface for
Git, since it's the one I [previously used] on ongardie.net. I added
https:// URLs for the Atom feed and also syntax highlighting
when viewing files.
HTTPS URLs for Cgit's Atom feed
Cgit generates Atom feeds so that you can keep track of changes from your
feed reader. Unfortunately, that requires a full URL, which it assumed
http://. This obviously didn't work for
I modified cgit to check the
HTTPS CGI variable. If it's set to
on, cgit now generates full URLs starting with
https://. While this isn't part of the official CGI spec, most
servers will set it, including Apache and lighttpd.
Lars Hjemli, the maintainer of cgit, merged in my change, so it should be part of a future cgit release:
This looks good. I've merged it into my wip-branch [...] where I'll let it cook for a little while before merging to my master.
Syntax Highlighting for Cgit
Cgit is useful for browsing around a project's history, but it didn't do syntax highlighting for source code. This made it unpleasant to use for reading complete files (as opposed to diffs).
I modified cgit to make use of the highlight program, when available, to color source code. If highlight is unavailable or fails, cgit falls back to the old black-and-white view.
While the patch is small and self-contained, it's specific to highlight and just tacked on in the source code. Lars didn't take this one:
I like the result, but I think the implementation has to be more generic. And I'm currently about to add support for a few plugins/hooks to cgit which I think can be used to achieve the same result so lets see how that works out first, ok?
I'll be working with Lars on getting a cleaner solution merged into his tree once he's added support for plugins.