ROGit

ROGit means Read Only Git website, it is different from well-known platforms like GitHub and only provide basic online preview web pages, so it is closer to “cgit” in function.

ROGit is built with RUST, it is powered by libgit2 and sqlite. Backend loads commits from git repositoies and parse them into local database to speed up query. Front page is rendered in server side to be compatible with client without JavaScript.

Git related services:

  • gitolite, gitlab-shell
  • gitlay
  • cgit, gitweb, gitiles, pagure
  • gogs, gitea, forgejo

Progress #

Git is hard to read and parse, for everything are stored in fs-kv database. There are three ways to connect object to web serve:

  1. Read all object when request
  2. Dump all before listen and serve
  3. Read from cache and update when not exist

All of them are time consumed, especially use libgit2 to manipulate git objects. Hard to imagine, 5~10x slower if we use this dynamic library than $ git command.

Of curse there is no optimization here, e.g.

$ git log -- path/file

We can only read commit hash, parent and tree first and read the rest we need, thus skip reading every commit message – they are useless except at the end of the ouput.

jj project is working on binding libgit.a (from git) to rust, waiting they complete.

# here is aports.git status

$ time git --no-pager log --oneline | wc -l
221100

real    0m1.554s
user    0m1.540s
sys	    0m0.299s

$ time git --no-pager log --oneline --name-status > /dev/null

real    1m36.475s
user    1m25.473s
sys	    0m10.832s

There is also a plan to make some tests, fixed git repository?


TODO: API

- /
- /<repo-name>
- /<repo-name>/-/{refs,tags}
- /<repo-name>/-/tag/<tag-name>
- /<repo-name>/-/{commit,patch,blob,tree,log}/<commit-hash>
- /<repo-name>/-/{commit,patch,blob,tree,log,blame,raw}/<commit-hash>/<path>
- /<repo-name>/-/{commit,patch,blob,tree,log}/<branch-name>
- /<repo-name>/-/{commit,patch,blob,tree,log,blame,raw}/<branch-name>/<path>
- /<repo-name>/-/{commit,patch,blob,tree,log}/<tag-name>
- /<repo-name>/-/{commit,patch,blob,tree,log,blame,raw}/<tag-name>/<path>
- /<repo-name>/-/archive/<commit-hash>.tar.gz
- /<repo-name>/-/archive/tag/<tag-name>.tar.gz