summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile15
-rw-r--r--cgit.c2
-rw-r--r--ui-shared.c9
-rw-r--r--ui-tag.c24
4 files changed, 39 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 60d8c58..4e101d3 100644
--- a/Makefile
+++ b/Makefile
@@ -13,2 +13,5 @@ INSTALL = install
#
+# Define NO_OPENSSL to disable linking with OpenSSL and use bundled SHA1
+# implementation (slower).
+#
# Define NEEDS_LIBICONV if linking with libc is not enough (eg. Darwin).
@@ -70,3 +73,3 @@ endif
-EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lcrypto
+EXTLIBS = git/libgit.a git/xdiff/lib.a -lz
OBJECTS =
@@ -125,2 +128,8 @@ ifdef NO_STRCASESTR
endif
+ifdef NO_OPENSSL
+ CFLAGS += -DNO_OPENSSL
+ GIT_OPTIONS += NO_OPENSSL=1
+else
+ EXTLIBS += -lcrypto
+endif
@@ -134,4 +143,4 @@ cgit.o: VERSION
libgit:
- $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 libgit.a
- $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 xdiff/lib.a
+ $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 $(GIT_OPTIONS) libgit.a
+ $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 $(GIT_OPTIONS) xdiff/lib.a
diff --git a/cgit.c b/cgit.c
index bd37788..a17f40d 100644
--- a/cgit.c
+++ b/cgit.c
@@ -211,2 +211,4 @@ static void querystring_cb(const char *name, const char *value)
} else if (!strcmp(name, "url")) {
+ if (*value == '/')
+ value++;
ctx.qry.url = xstrdup(value);
diff --git a/ui-shared.c b/ui-shared.c
index 4049a2b..3a9e67b 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -762,4 +762,10 @@ void cgit_print_snapshot_links(const char *repo, const char *head,
const struct cgit_snapshot_format* f;
+ char *prefix;
char *filename;
+ unsigned char sha1[20];
+ if (get_sha1(fmt("refs/tags/%s", hex), sha1) == 0 &&
+ (hex[0] == 'v' || hex[0] == 'V') && isdigit(hex[1]))
+ hex++;
+ prefix = xstrdup(fmt("%s-%s", cgit_repobasename(repo), hex));
for (f = cgit_snapshot_formats; f->suffix; f++) {
@@ -767,4 +773,3 @@ void cgit_print_snapshot_links(const char *repo, const char *head,
continue;
- filename = fmt("%s-%s%s", cgit_repobasename(repo), hex,
- f->suffix);
+ filename = fmt("%s%s", prefix, f->suffix);
cgit_snapshot_link(filename, NULL, NULL, NULL, NULL, filename);
diff --git a/ui-tag.c b/ui-tag.c
index c2d72af..39e4cb8 100644
--- a/ui-tag.c
+++ b/ui-tag.c
@@ -32,2 +32,10 @@ static void print_tag_content(char *buf)
+void print_download_links(char *revname)
+{
+ html("<tr><th>download</th><td class='sha1'>");
+ cgit_print_snapshot_links(ctx.qry.repo, ctx.qry.head,
+ revname, ctx.repo->snapshots);
+ html("</td></tr>");
+}
+
void cgit_print_tag(char *revname)
@@ -58,3 +66,3 @@ void cgit_print_tag(char *revname)
html("<table class='commit-info'>\n");
- htmlf("<tr><td>Tag name</td><td>");
+ htmlf("<tr><td>tag name</td><td>");
html_txt(revname);
@@ -62,3 +70,3 @@ void cgit_print_tag(char *revname)
if (info->tagger_date > 0) {
- html("<tr><td>Tag date</td><td>");
+ html("<tr><td>tag date</td><td>");
cgit_print_date(info->tagger_date, FMT_LONGDATE, ctx.cfg.local_time);
@@ -67,3 +75,3 @@ void cgit_print_tag(char *revname)
if (info->tagger) {
- html("<tr><td>Tagged by</td><td>");
+ html("<tr><td>tagged by</td><td>");
html_txt(info->tagger);
@@ -75,5 +83,7 @@ void cgit_print_tag(char *revname)
}
- html("<tr><td>Tagged object</td><td>");
+ html("<tr><td>tagged object</td><td class='sha1'>");
cgit_object_link(tag->tagged);
html("</td></tr>\n");
+ if (ctx.repo->snapshots)
+ print_download_links(revname);
html("</table>\n");
@@ -82,8 +92,10 @@ void cgit_print_tag(char *revname)
html("<table class='commit-info'>\n");
- htmlf("<tr><td>Tag name</td><td>");
+ htmlf("<tr><td>tag name</td><td>");
html_txt(revname);
html("</td></tr>\n");
- html("<tr><td>Tagged object</td><td>");
+ html("<tr><td>Tagged object</td><td class='sha1'>");
cgit_object_link(obj);
html("</td></tr>\n");
+ if (ctx.repo->snapshots)
+ print_download_links(revname);
html("</table>\n");