about summary refs log tree commit diff
path: root/services/cgit-taz/cgit_depot_url.patch
blob: 5ca28573714fe272c2333f51fd7f39f58e427267 (plain) (blame)
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
diff --git a/ui-shared.c b/ui-shared.c
index 739505a..5c3e7bc 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -95,29 +95,23 @@ 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);
+	// my cgit instance *only* serves the depot, hence that's the only value ever
+	// needed.
+	return "/";
 }
 
 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 = "&";
+	strbuf_addf(&sb, "%s%s/%s", ctx.cfg.virtual_root,
+		pagename, (filename ? filename:""));
+
+	if (query) {
+		strbuf_addf(&sb, "%s%s", "?", query);
 	}
-	if (query)
-		strbuf_addf(&sb, "%s%s", delim, query);
+
 	return strbuf_detach(&sb, NULL);
 }