summary refs log tree commit diff
path: root/fleet/hosts/trieste/cgit/monorepo-support.patch
blob: f634d9c36bb3bfbf442a0aa056f771ace25bd68b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
SPDX-FileCopyrightText: V <v@unfathomable.blue>
SPDX-License-Identifier: OSL-3.0
diff --git a/cgit.c b/cgit.c
index dd28a79..1426a72 100644
--- a/cgit.c
+++ b/cgit.c
@@ -603,7 +603,7 @@ static int prepare_repo_cmd(int nongit)
 		cgit_print_docend();
 		return 1;
 	}
-	ctx.page.title = fmtalloc("%s - %s", ctx.repo->name, ctx.repo->desc);
+	ctx.page.title = ctx.cfg.root_title;
 
 	if (!ctx.repo->defbranch)
 		ctx.repo->defbranch = guess_defbranch();
diff --git a/ui-shared.c b/ui-shared.c
index 72a1505..d798d99 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -129,29 +129,17 @@ const char *cgit_loginurl(void)
 
 char *cgit_repourl(const char *reponame)
 {
-	if (ctx.cfg.virtual_root)
-		return fmtalloc("%s%s/", ctx.cfg.virtual_root, reponame);
-	else
-		return fmtalloc("?r=%s", reponame);
+	return fmtalloc("%s/", ctx.cfg.virtual_root);
 }
 
 char *cgit_fileurl(const char *reponame, const char *pagename,
 		   const char *filename, const char *query)
 {
 	struct strbuf sb = STRBUF_INIT;
-	char *delim;
-
-	if (ctx.cfg.virtual_root) {
-		strbuf_addf(&sb, "%s%s/%s/%s", ctx.cfg.virtual_root, reponame,
-			    pagename, (filename ? filename:""));
-		delim = "?";
-	} else {
-		strbuf_addf(&sb, "?url=%s/%s/%s", reponame, pagename,
-			    (filename ? filename : ""));
-		delim = "&amp;";
-	}
+	strbuf_addf(&sb, "%s/%s/%s", ctx.cfg.virtual_root,
+		    pagename, (filename ? filename:""));
 	if (query)
-		strbuf_addf(&sb, "%s%s", delim, query);
+		strbuf_addf(&sb, "?%s", query);
 	return strbuf_detach(&sb, NULL);
 }
 
@@ -277,30 +265,12 @@ static char *repolink(const char *title, const char *class, const char *page,
 		html("'");
 	}
 	html(" href='");
-	if (ctx.cfg.virtual_root) {
-		html_url_path(ctx.cfg.virtual_root);
-		html_url_path(ctx.repo->url);
-		if (ctx.repo->url[strlen(ctx.repo->url) - 1] != '/')
-			html("/");
-		if (page) {
-			html_url_path(page);
-			html("/");
-			if (path)
-				html_url_path(path);
-		}
-	} else {
-		html_url_path(ctx.cfg.script_name);
-		html("?url=");
-		html_url_arg(ctx.repo->url);
-		if (ctx.repo->url[strlen(ctx.repo->url) - 1] != '/')
-			html("/");
-		if (page) {
-			html_url_arg(page);
-			html("/");
-			if (path)
-				html_url_arg(path);
-		}
-		delim = "&amp;";
+	html_url_path(ctx.cfg.virtual_root);
+	if (page) {
+		html_url_path(page);
+		html("/");
+		if (path)
+			html_url_path(path);
 	}
 	if (head && ctx.repo->defbranch && strcmp(head, ctx.repo->defbranch)) {
 		html(delim);
@@ -1001,44 +971,27 @@ static void print_header(void)
 	}
 
 	html("<td class='main'>");
-	if (ctx.repo) {
-		cgit_index_link("index", NULL, NULL, NULL, NULL, 0, 1);
-		html(" : ");
-		cgit_summary_link(ctx.repo->name, NULL, NULL, NULL);
-		if (ctx.env.authenticated) {
-			html("</td><td class='form'>");
-			html("<form method='get'>\n");
-			cgit_add_hidden_formfields(0, 1, ctx.qry.page);
-			html("<select name='h' onchange='this.form.submit();'>\n");
-			print_this_commit_option();
-			html("<optgroup label='branches'>");
-			for_each_branch_ref(print_branch_option, ctx.qry.head);
-			if (ctx.repo->enable_remote_branches)
-				for_each_remote_ref(print_branch_option, ctx.qry.head);
-			html("</optgroup>");
-			html("</select> ");
-			html("<input type='submit' value='switch'/>");
-			html("</form>");
-		}
-	} else
-		html_txt(ctx.cfg.root_title);
+	cgit_index_link(ctx.cfg.root_title, NULL, NULL, NULL, NULL, 0, 1);
+	if (ctx.env.authenticated) {
+		html("</td><td class='form'>");
+		html("<form method='get'>\n");
+		cgit_add_hidden_formfields(0, 1, ctx.qry.page);
+		html("<select name='h' onchange='this.form.submit();'>\n");
+		print_this_commit_option();
+		html("<optgroup label='branches'>");
+		for_each_branch_ref(print_branch_option, ctx.qry.head);
+		if (ctx.repo->enable_remote_branches)
+			for_each_remote_ref(print_branch_option, ctx.qry.head);
+		html("</optgroup>");
+		html("</select> ");
+		html("<input type='submit' value='switch'/>");
+		html("</form>");
+	}
 	html("</td></tr>\n");
 
 	html("<tr><td class='sub'>");
-	if (ctx.repo) {
-		html_txt(ctx.repo->desc);
-		html("</td><td class='sub right'>");
-		if (ctx.repo->owner_filter) {
-			cgit_open_filter(ctx.repo->owner_filter);
-			html_txt(ctx.repo->owner);
-			cgit_close_filter(ctx.repo->owner_filter);
-		} else {
-			html_txt(ctx.repo->owner);
-		}
-	} else {
-		if (ctx.cfg.root_desc)
-			html_txt(ctx.cfg.root_desc);
-	}
+	if (ctx.cfg.root_desc)
+		html_txt(ctx.cfg.root_desc);
 	html("</td></tr></table>\n");
 }