From c994b9baaabea481d06bf80fbb19dc43dd1ec9cc Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Tue, 3 Jan 2023 15:04:53 +0100 Subject: git: enable cgit cache, about page, clone-url --- roles/git/files/gitolite-cgit/entrypoint.sh | 7 +++++++ roles/git/files/gitolite-cgit/etc/cgitrc | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) (limited to 'roles/git/files') diff --git a/roles/git/files/gitolite-cgit/entrypoint.sh b/roles/git/files/gitolite-cgit/entrypoint.sh index 905bf97..873a0ac 100755 --- a/roles/git/files/gitolite-cgit/entrypoint.sh +++ b/roles/git/files/gitolite-cgit/entrypoint.sh @@ -22,9 +22,16 @@ if [ ! -f /var/lib/git/.ssh/authorized_keys ]; then su - git -c 'gitolite setup --pubkey /tmp/admin.pub' rm -f /tmp/admin.pub else + # Fixup gitolite, eg in case a new repo was added manually. su - git -c 'gitolite setup' fi +# -- SETUP: cgit --------------------------------------------------------------- + +# Ensure default cache directory exists. +# Adapt if cache-root is changed in cgitrc(5). +mkdir -p /var/cache/cgit + # -- SETUP: sshd --------------------------------------------------------------- # Generate ssh host keys (nop if keys already exist). diff --git a/roles/git/files/gitolite-cgit/etc/cgitrc b/roles/git/files/gitolite-cgit/etc/cgitrc index e60b893..b84b441 100644 --- a/roles/git/files/gitolite-cgit/etc/cgitrc +++ b/roles/git/files/gitolite-cgit/etc/cgitrc @@ -1,8 +1,13 @@ # cgitrc(5) +# Enable caching of html files to /var/cache/cgit (unit is objects). +cache-size=1000 + root-title=git.memzero.de root-desc=private git repostitory +clone-url=https://git.memzero.de/$CGIT_REPO_URL ssh://git.memzero.de/$CGIT_REPO_URL git@git.memzero.de:$CGIT_REPO_URL + virtual-root=/ enable-blame=1 @@ -23,6 +28,17 @@ about-filter=/usr/lib/cgit/filters/about-formatting.sh remove-suffix=1 section-from-path=1 +# -- About page + +# Global default files to look for to render the repos about page (first match taken). +# +# Leading colon means to search for file relative from remote HEAD +# (aka default branch). +# Cgit allows to specify a different refspec (:) to render the +# about page, however this is mainly useful for repo specific settings. +readme=:README.md +readme=:README.txt + # -- Repositories # # Scan *scan-path* for repositories. Since *project-list* is specified before, -- cgit v1.2.3