the repository which powers this website
Diffstat (limited to 'ui-shared.c')
-rw-r--r--ui-shared.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 5853a969..8922e7d3 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -318,6 +318,43 @@ static char *repolink(const char *title, const char *class, const char *page,
return fmt("%s", delim);
}
+void cgit_shared_repolink_url(const char *page, const char *head, const char *path)
+{
+ char *delim = "?";
+
+ 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 = "&";
+ }
+ if (head && ctx.repo->defbranch && strcmp(head, ctx.repo->defbranch)) {
+ html(delim);
+ html("h=");
+ html_url_arg(head);
+ delim = "&";
+ }
+}
+
static void reporevlink(const char *page, const char *name, const char *title,
const char *class, const char *head, const char *rev,
const char *path)