refactor call the root title root_title everywhere

One concept had four names across three layers: Config.title held it, the TOML key was ogit_root_title, Layout.site called it root_title, and Handlers.root_title computed it from those. Rename the record field to root_title so the field, the key and the site setting agree, and rename the handler to resolve_root_title, which says what it adds: the fallback to "Repositories for <user_name>". The TOML keys are untouched — ogit_root_title stays current and a bare title stays accepted — so existing configuration files are unaffected.

Commit
b57b41c2e0e927ad96dd8445079b68231fe36693
Author
Claude Sonnet 4 <claude@anthropic.invalid>
Author date
Committer
Marius Peter <dev@marius-peter.com>
Committer date
Changed files
lib/config.ml
index 3f346c54..2c437152 100644..100644
@@ -23,7 +23,7 @@
23 23 default_branch : string;
24 24 git_project_root : string;
25 25 commits_max_displayed : int;
26 Removed: title : string;
26 Added: root_title : string;
27 27 nav_logo : string;
28 28 host : string;
29 29 port : int;
@@ -46,7 +46,7 @@
46 46 default_branch = "main";
47 47 git_project_root = "/srv/git";
48 48 commits_max_displayed = 10;
49 Removed: title = "";
49 Added: root_title = "";
50 50 nav_logo = "/static/git_icon.svg";
51 51 host = "127.0.0.1";
52 52 port = 8081;
@@ -75,7 +75,7 @@
75 75 ("default_branch", TString t.default_branch);
76 76 ("git_project_root", TString t.git_project_root);
77 77 ("commits_max_displayed", TInt t.commits_max_displayed);
78 Removed: ("ogit_root_title", TString t.title);
78 Added: ("ogit_root_title", TString t.root_title);
79 79 ("nav_logo", TString t.nav_logo);
80 80 ("host", TString t.host);
81 81 ("port", TInt t.port);
@@ -140,10 +140,13 @@
140 140 in
141 141 let* default_branch = required_string table "default_branch" in
142 142 let* commits_max_displayed = required_int table "commits_max_displayed" in
143 Removed: let* title =
143 Added: (* [ogit_root_title] is the current key; a bare [title] is still accepted so
144 Added: that configuration files predating the rename keep working. *)
145 Added: let* root_title =
144 146 match Types.Table.find_opt (Min.key "ogit_root_title") table with
145 Removed: | Some _ -> optional_string table "ogit_root_title" ~default:default.title
146 Removed: | None -> optional_string table "title" ~default:default.title
147 Added: | Some _ ->
148 Added: optional_string table "ogit_root_title" ~default:default.root_title
149 Added: | None -> optional_string table "title" ~default:default.root_title
147 150 in
148 151 let* nav_logo = optional_string table "nav_logo" ~default:default.nav_logo in
149 152 let* host = optional_string table "host" ~default:default.host in
@@ -165,7 +168,7 @@
165 168 user_name;
166 169 default_branch;
167 170 commits_max_displayed;
168 Removed: title;
171 Added: root_title;
169 172 nav_logo;
170 173 host;
171 174 port;
lib/handlers.ml
index 0d7c32bb..09eb91ff 100644..100644
@@ -36,14 +36,18 @@
36 36 in
37 37 Views.error_page ~status ~title message
38 38
39 Removed: let root_title config =
40 Removed: if config.Config.title = "" then
39 Added: (* The configured title wins; otherwise derive one from the user name. Named for
40 Added: the resolution it performs, to distinguish it from the [root_title] fields it
41 Added: reads and writes. *)
42 Added: let resolve_root_title config =
43 Added: if config.Config.root_title = "" then
41 44 if config.Config.user_name = "" then "Repositories"
42 45 else "Repositories for " ^ config.Config.user_name
43 Removed: else config.Config.title
46 Added: else config.Config.root_title
44 47
45 48 let site config =
46 Removed: Layout.site ~user_name:config.Config.user_name ~root_title:(root_title config)
49 Added: Layout.site ~user_name:config.Config.user_name
50 Added: ~root_title:(resolve_root_title config)
47 51 ~nav_logo:config.Config.nav_logo
48 52
49 53 let collect_repo_paths nodes =
test/test_config.ml
index ce62c73f..864d0b98 100644..100644
@@ -14,7 +14,7 @@
14 14 default_branch = "main";
15 15 git_project_root = "/srv/git";
16 16 commits_max_displayed = 25;
17 Removed: title = "";
17 Added: root_title = "";
18 18 nav_logo = "/branding/logo.svg";
19 19 host = "127.0.0.1";
20 20 port = 9000;
@@ -49,7 +49,7 @@
49 49 | Ok config ->
50 50 Alcotest.(check string) "default user_name" "" config.user_name;
51 51 Alcotest.(check string)
52 Removed: "legacy title" "Legacy repositories" config.title;
52 Added: "legacy title" "Legacy repositories" config.root_title;
53 53 Alcotest.(check string)
54 54 "default nav logo" "/static/git_icon.svg" config.nav_logo;
55 55 Alcotest.(check string) "default host" "127.0.0.1" config.host;