diff options
-rw-r--r-- | Makefile | 15 | ||||
-rw-r--r-- | cgit.c | 2 | ||||
-rw-r--r-- | ui-shared.c | 9 | ||||
-rw-r--r-- | ui-tag.c | 24 |
4 files changed, 39 insertions, 11 deletions
@@ -11,6 +11,9 @@ INSTALL = install | |||
11 | 11 | ||
12 | # Define NO_STRCASESTR if you don't have strcasestr. | 12 | # Define NO_STRCASESTR if you don't have strcasestr. |
13 | # | 13 | # |
14 | # Define NO_OPENSSL to disable linking with OpenSSL and use bundled SHA1 | ||
15 | # implementation (slower). | ||
16 | # | ||
14 | # Define NEEDS_LIBICONV if linking with libc is not enough (eg. Darwin). | 17 | # Define NEEDS_LIBICONV if linking with libc is not enough (eg. Darwin). |
15 | # | 18 | # |
16 | 19 | ||
@@ -68,7 +71,7 @@ endif | |||
68 | $(QUIET_CC)$(CC) -o $*.o -c $(CFLAGS) $< | 71 | $(QUIET_CC)$(CC) -o $*.o -c $(CFLAGS) $< |
69 | 72 | ||
70 | 73 | ||
71 | EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lcrypto | 74 | EXTLIBS = git/libgit.a git/xdiff/lib.a -lz |
72 | OBJECTS = | 75 | OBJECTS = |
73 | OBJECTS += cache.o | 76 | OBJECTS += cache.o |
74 | OBJECTS += cgit.o | 77 | OBJECTS += cgit.o |
@@ -123,6 +126,12 @@ endif | |||
123 | ifdef NO_STRCASESTR | 126 | ifdef NO_STRCASESTR |
124 | CFLAGS += -DNO_STRCASESTR | 127 | CFLAGS += -DNO_STRCASESTR |
125 | endif | 128 | endif |
129 | ifdef NO_OPENSSL | ||
130 | CFLAGS += -DNO_OPENSSL | ||
131 | GIT_OPTIONS += NO_OPENSSL=1 | ||
132 | else | ||
133 | EXTLIBS += -lcrypto | ||
134 | endif | ||
126 | 135 | ||
127 | cgit: $(OBJECTS) libgit | 136 | cgit: $(OBJECTS) libgit |
128 | $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o cgit $(OBJECTS) $(EXTLIBS) | 137 | $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o cgit $(OBJECTS) $(EXTLIBS) |
@@ -132,8 +141,8 @@ cgit.o: VERSION | |||
132 | -include $(OBJECTS:.o=.d) | 141 | -include $(OBJECTS:.o=.d) |
133 | 142 | ||
134 | libgit: | 143 | libgit: |
135 | $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 libgit.a | 144 | $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 $(GIT_OPTIONS) libgit.a |
136 | $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 xdiff/lib.a | 145 | $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 $(GIT_OPTIONS) xdiff/lib.a |
137 | 146 | ||
138 | test: all | 147 | test: all |
139 | $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all | 148 | $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all |
@@ -209,6 +209,8 @@ static void querystring_cb(const char *name, const char *value) | |||
209 | } else if (!strcmp(name, "p")) { | 209 | } else if (!strcmp(name, "p")) { |
210 | ctx.qry.page = xstrdup(value); | 210 | ctx.qry.page = xstrdup(value); |
211 | } else if (!strcmp(name, "url")) { | 211 | } else if (!strcmp(name, "url")) { |
212 | if (*value == '/') | ||
213 | value++; | ||
212 | ctx.qry.url = xstrdup(value); | 214 | ctx.qry.url = xstrdup(value); |
213 | cgit_parse_url(value); | 215 | cgit_parse_url(value); |
214 | } else if (!strcmp(name, "qt")) { | 216 | } else if (!strcmp(name, "qt")) { |
diff --git a/ui-shared.c b/ui-shared.c index 4049a2b..3a9e67b 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -760,13 +760,18 @@ void cgit_print_snapshot_links(const char *repo, const char *head, | |||
760 | const char *hex, int snapshots) | 760 | const char *hex, int snapshots) |
761 | { | 761 | { |
762 | const struct cgit_snapshot_format* f; | 762 | const struct cgit_snapshot_format* f; |
763 | char *prefix; | ||
763 | char *filename; | 764 | char *filename; |
765 | unsigned char sha1[20]; | ||
764 | 766 | ||
767 | if (get_sha1(fmt("refs/tags/%s", hex), sha1) == 0 && | ||
768 | (hex[0] == 'v' || hex[0] == 'V') && isdigit(hex[1])) | ||
769 | hex++; | ||
770 | prefix = xstrdup(fmt("%s-%s", cgit_repobasename(repo), hex)); | ||
765 | for (f = cgit_snapshot_formats; f->suffix; f++) { | 771 | for (f = cgit_snapshot_formats; f->suffix; f++) { |
766 | if (!(snapshots & f->bit)) | 772 | if (!(snapshots & f->bit)) |
767 | continue; | 773 | continue; |
768 | filename = fmt("%s-%s%s", cgit_repobasename(repo), hex, | 774 | filename = fmt("%s%s", prefix, f->suffix); |
769 | f->suffix); | ||
770 | cgit_snapshot_link(filename, NULL, NULL, NULL, NULL, filename); | 775 | cgit_snapshot_link(filename, NULL, NULL, NULL, NULL, filename); |
771 | html("<br/>"); | 776 | html("<br/>"); |
772 | } | 777 | } |
@@ -30,6 +30,14 @@ static void print_tag_content(char *buf) | |||
30 | } | 30 | } |
31 | } | 31 | } |
32 | 32 | ||
33 | void print_download_links(char *revname) | ||
34 | { | ||
35 | html("<tr><th>download</th><td class='sha1'>"); | ||
36 | cgit_print_snapshot_links(ctx.qry.repo, ctx.qry.head, | ||
37 | revname, ctx.repo->snapshots); | ||
38 | html("</td></tr>"); | ||
39 | } | ||
40 | |||
33 | void cgit_print_tag(char *revname) | 41 | void cgit_print_tag(char *revname) |
34 | { | 42 | { |
35 | unsigned char sha1[20]; | 43 | unsigned char sha1[20]; |
@@ -56,16 +64,16 @@ void cgit_print_tag(char *revname) | |||
56 | return; | 64 | return; |
57 | } | 65 | } |
58 | html("<table class='commit-info'>\n"); | 66 | html("<table class='commit-info'>\n"); |
59 | htmlf("<tr><td>Tag name</td><td>"); | 67 | htmlf("<tr><td>tag name</td><td>"); |
60 | html_txt(revname); | 68 | html_txt(revname); |
61 | htmlf(" (%s)</td></tr>\n", sha1_to_hex(sha1)); | 69 | htmlf(" (%s)</td></tr>\n", sha1_to_hex(sha1)); |
62 | if (info->tagger_date > 0) { | 70 | if (info->tagger_date > 0) { |
63 | html("<tr><td>Tag date</td><td>"); | 71 | html("<tr><td>tag date</td><td>"); |
64 | cgit_print_date(info->tagger_date, FMT_LONGDATE, ctx.cfg.local_time); | 72 | cgit_print_date(info->tagger_date, FMT_LONGDATE, ctx.cfg.local_time); |
65 | html("</td></tr>\n"); | 73 | html("</td></tr>\n"); |
66 | } | 74 | } |
67 | if (info->tagger) { | 75 | if (info->tagger) { |
68 | html("<tr><td>Tagged by</td><td>"); | 76 | html("<tr><td>tagged by</td><td>"); |
69 | html_txt(info->tagger); | 77 | html_txt(info->tagger); |
70 | if (info->tagger_email && !ctx.cfg.noplainemail) { | 78 | if (info->tagger_email && !ctx.cfg.noplainemail) { |
71 | html(" "); | 79 | html(" "); |
@@ -73,19 +81,23 @@ void cgit_print_tag(char *revname) | |||
73 | } | 81 | } |
74 | html("</td></tr>\n"); | 82 | html("</td></tr>\n"); |
75 | } | 83 | } |
76 | html("<tr><td>Tagged object</td><td>"); | 84 | html("<tr><td>tagged object</td><td class='sha1'>"); |
77 | cgit_object_link(tag->tagged); | 85 | cgit_object_link(tag->tagged); |
78 | html("</td></tr>\n"); | 86 | html("</td></tr>\n"); |
87 | if (ctx.repo->snapshots) | ||
88 | print_download_links(revname); | ||
79 | html("</table>\n"); | 89 | html("</table>\n"); |
80 | print_tag_content(info->msg); | 90 | print_tag_content(info->msg); |
81 | } else { | 91 | } else { |
82 | html("<table class='commit-info'>\n"); | 92 | html("<table class='commit-info'>\n"); |
83 | htmlf("<tr><td>Tag name</td><td>"); | 93 | htmlf("<tr><td>tag name</td><td>"); |
84 | html_txt(revname); | 94 | html_txt(revname); |
85 | html("</td></tr>\n"); | 95 | html("</td></tr>\n"); |
86 | html("<tr><td>Tagged object</td><td>"); | 96 | html("<tr><td>Tagged object</td><td class='sha1'>"); |
87 | cgit_object_link(obj); | 97 | cgit_object_link(obj); |
88 | html("</td></tr>\n"); | 98 | html("</td></tr>\n"); |
99 | if (ctx.repo->snapshots) | ||
100 | print_download_links(revname); | ||
89 | html("</table>\n"); | 101 | html("</table>\n"); |
90 | } | 102 | } |
91 | return; | 103 | return; |