X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/093ac9697068833a15cae2dbbd5ffbc0203741c0..HEAD:/ui-shared.c?ds=sidebyside
diff --git a/ui-shared.c b/ui-shared.c
index 7c7a537..6fae72d 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -6,6 +6,8 @@
* (see COPYING for full license text)
*/
+#define USE_THE_REPOSITORY_VARIABLE
+
#include "cgit.h"
#include "ui-shared.h"
#include "cmd.h"
@@ -662,18 +664,18 @@ void cgit_submodule_link(const char *class, char *path, const char *rev)
path[len - 1] = tail;
}
-const struct date_mode *cgit_date_mode(enum date_mode_type type)
+const struct date_mode cgit_date_mode(enum date_mode_type type)
{
static struct date_mode mode;
mode.type = type;
mode.local = ctx.cfg.local_time;
- return &mode;
+ return mode;
}
static void print_rel_date(time_t t, int tz, double value,
const char *class, const char *suffix)
{
- htmlf("%.0f %s", value, suffix);
}
@@ -770,6 +772,10 @@ static void print_rel_vcs_link(const char *url)
static int emit_css_link(struct string_list_item *s, void *arg)
{
+ /* Do not emit anything if css= is specified. */
+ if (s && *s->string == '\0')
+ return 0;
+
html("\n");
+
+ return 0;
+}
+
void cgit_print_docstart(void)
{
char *host = cgit_hosturl();
@@ -805,6 +827,11 @@ void cgit_print_docstart(void)
else
emit_css_link(NULL, "/cgit.css");
+ if (ctx.cfg.js.items)
+ for_each_string_list(&ctx.cfg.js, emit_js_link, NULL);
+ else
+ emit_js_link(NULL, "/cgit.js");
+
if (ctx.cfg.favicon) {
html("\n");
cgit_add_hidden_formfields(0, 1, ctx.qry.page);
html(" ");
html("");
html("");
@@ -1163,11 +1192,11 @@ void cgit_compose_snapshot_prefix(struct strbuf *filename, const char *base,
* name starts with {v,V}[0-9] and the prettify mapping is injective,
* i.e. each stripped tag can be inverted without ambiguities.
*/
- if (get_oid(fmt("refs/tags/%s", ref), &oid) == 0 &&
+ if (repo_get_oid(the_repository, fmt("refs/tags/%s", ref), &oid) == 0 &&
(ref[0] == 'v' || ref[0] == 'V') && isdigit(ref[1]) &&
- ((get_oid(fmt("refs/tags/%s", ref + 1), &oid) == 0) +
- (get_oid(fmt("refs/tags/v%s", ref + 1), &oid) == 0) +
- (get_oid(fmt("refs/tags/V%s", ref + 1), &oid) == 0) == 1))
+ ((repo_get_oid(the_repository, fmt("refs/tags/%s", ref + 1), &oid) == 0) +
+ (repo_get_oid(the_repository, fmt("refs/tags/v%s", ref + 1), &oid) == 0) +
+ (repo_get_oid(the_repository, fmt("refs/tags/V%s", ref + 1), &oid) == 0) == 1))
ref++;
strbuf_addf(filename, "%s-%s", base, ref);