From 4337bf29dc05a5bae3b628acb38643a2ce5419e4 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Tue, 13 Aug 2024 22:31:59 +0200 Subject: fix(nixos/git-server): Correctly specify the section from path length Cgit effectively splits the repo path on '/' and then takes `section-from-path` segments, which form the section. A negative value here results in cgit traversing the path from left to right instead of right to left. Beware that cgit only sets the section, if the path contains `section-from-path` or more slashes in it (thus rendering this setting defunct with the previous value of 1000). There seems to be no way to tell cgit to always use all components up-to the second to last for the section name, thus requiring all projects that need a longer than 1 section length to set the `cgit.section` git config variable via gitolite. --- modules/nixos/vhack/git-server/default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/nixos/vhack/git-server/default.nix b/modules/nixos/vhack/git-server/default.nix index 83e18f8..bf78f80 100644 --- a/modules/nixos/vhack/git-server/default.nix +++ b/modules/nixos/vhack/git-server/default.nix @@ -161,8 +161,9 @@ in { css = "/custom_cgit.css"; # This is a number of path elements to treat as section. - # Set this to a big number to ensure all path elements are treated as sections. - section-from-path = 1000; + # Per default one, for the users. Orgs should use the `cgit.section` key to set + # a correct section name. + section-from-path = 1; project-list = "${config.services.gitolite.dataDir}/projects.list"; -- cgit 1.4.1