Commit Diff


commit - 067396e6118227d9aa15a49c7d49238c0fff8d94
commit + dc07f76c4f8d4418ce30fd4eb087756fe9fb6ded
blob - b0073bd432cd5dcf72ae7f82e1d97d8ae4f6a8f0
blob + 309aef401c71adbc97aca9f379c2f05fb4470122
--- gotwebd/gotweb.c
+++ gotwebd/gotweb.c
@@ -96,7 +96,6 @@ static const struct got_error *gotweb_get_clone_url(ch
 static const struct got_error *gotweb_render_blame(struct request *);
 static const struct got_error *gotweb_render_diff(struct request *);
 static const struct got_error *gotweb_render_summary(struct request *);
-static const struct got_error *gotweb_render_tag(struct request *);
 static const struct got_error *gotweb_render_tags(struct request *);
 static const struct got_error *gotweb_render_branches(struct request *);
 
@@ -291,11 +290,18 @@ render:
 		}
 		break;
 	case TAG:
-		error = gotweb_render_tag(c);
+		error = got_get_repo_tags(c, 1);
 		if (error) {
 			log_warnx("%s: %s", __func__, error->msg);
+			goto err;
+		}
+		if (c->t->tag_count == 0) {
+			error = got_error_msg(GOT_ERR_BAD_OBJ_ID,
+			    "bad commit id");
 			goto err;
 		}
+		if (gotweb_render_tag(c->tp) == -1)
+			goto done;
 		break;
 	case TAGS:
 		error = gotweb_render_tags(c);
@@ -1257,77 +1263,6 @@ done:
 }
 
 static const struct got_error *
-gotweb_render_tag(struct request *c)
-{
-	const struct got_error *error = NULL;
-	struct repo_tag *rt = NULL;
-	struct transport *t = c->t;
-	char *tagname = NULL, *age = NULL, *author = NULL, *msg = NULL;
-
-	error = got_get_repo_tags(c, 1);
-	if (error)
-		goto done;
-
-	if (t->tag_count == 0) {
-		error = got_error_set_errno(GOT_ERR_BAD_OBJ_ID,
-		    "bad commit id");
-		goto done;
-	}
-
-	rt = TAILQ_LAST(&t->repo_tags, repo_tags_head);
-
-	error = gotweb_get_time_str(&age, rt->tagger_time, TM_LONG);
-	if (error)
-		goto done;
-	error = gotweb_escape_html(&author, rt->tagger);
-	if (error)
-		goto done;
-	error = gotweb_escape_html(&msg, rt->commit_msg);
-	if (error)
-		goto done;
-
-	tagname = rt->tag_name;
-	if (strncmp(tagname, "refs/", 5) == 0)
-		tagname += 5;
-	error = gotweb_escape_html(&tagname, tagname);
-	if (error)
-		goto done;
-
-	fcgi_printf(c, "<div id='tags_title_wrapper'>\n"
-	    "<div id='tags_title'>Tag</div>\n"
-	    "</div>\n"		/* #tags_title_wrapper */
-	    "<div id='tags_content'>\n"
-	    "<div id='tag_header_wrapper'>\n"
-	    "<div id='tag_header'>\n"
-	    "<div class='header_commit_title'>Commit:</div>\n"
-	    "<div class='header_commit'>%s"
-	    " <span class='refs_str'>(%s)</span></div>\n"
-	    "<div class='header_author_title'>Tagger:</div>\n"
-	    "<div class='header_author'>%s</div>\n"
-	    "<div class='header_age_title'>Date:</div>\n"
-	    "<div class='header_age'>%s</div>\n"
-	    "<div id='header_commit_msg_title'>Message:</div>\n"
-	    "<div id='header_commit_msg'>%s</div>\n"
-	    "</div>\n"		/* #tag_header */
-	    "<div class='dotted_line'></div>\n"
-	    "<div id='tag_commit'>\n%s</div>"
-	    "</div>"		/* #tag_header_wrapper */
-	    "</div>",		/* #tags_content */
-	    rt->commit_id,
-	    tagname,
-	    author,
-	    age,
-	    msg,
-	    rt->tag_commit);
-
-done:
-	free(age);
-	free(author);
-	free(msg);
-	return error;
-}
-
-static const struct got_error *
 gotweb_render_tags(struct request *c)
 {
 	const struct got_error *error = NULL;
blob - 82411f713d7bde00ef0d95f07bf0b914771735ed
blob + ebc2cd4755644f05a3fdaeaf2fe96f60466272ce
--- gotwebd/gotwebd.h
+++ gotwebd/gotwebd.h
@@ -470,6 +470,7 @@ int	gotweb_render_commits(struct template *);
 int	gotweb_render_blob(struct template *, struct got_blob_object *);
 int	gotweb_render_tree(struct template *);
 int	gotweb_render_tags_tmpl(struct template *);
+int	gotweb_render_tag(struct template *);
 int	gotweb_render_rss(struct template *);
 
 /* parse.y */
blob - 8bf0a13026da2c453ceba474ad9e4fd12b90c713
blob + c86368b829792b47babd7f6fcae03da0daa1a225
--- gotwebd/pages.tmpl
+++ gotwebd/pages.tmpl
@@ -648,7 +648,50 @@ gotweb_render_age(struct template *tp, time_t time, in
 </div>
 <div class="dotted_line"></div>
 {{ end }}
+
+{{ define gotweb_render_tag(struct template *tp) }}
+{!
+	struct request		*c = tp->tp_arg;
+	struct transport	*t = c->t;
+	struct repo_tag		*rt;
+	const char		*tag_name;
 
+	rt = TAILQ_LAST(&t->repo_tags, repo_tags_head);
+	tag_name = rt->tag_name;
+
+	if (strncmp(tag_name, "refs/", 5) == 0)
+		tag_name += 5;
+!}
+<div id="tags_title_wrapper">
+  <div id="tags_title">Tag</div>
+</div>
+<div id="tags_content">
+  <div id="tag_header_wrapper">
+    <div id="tag_header">
+      <div class="header_commit_title">Commit:</div>
+      <div class="header_commit">
+        {{ rt->commit_id }}
+        {{ " " }}
+        <span class="refs_str">({{ tag_name }})</span>
+      </div>
+      <div class="header_author_title">Tagger:</div>
+      <div class="header_author">{{ rt->tagger }}</div>
+      <div class="header_age_title">Date:</div>
+      <div class="header_age">
+        {{ render gotweb_render_age(tp, rt->tagger_time, TM_LONG)}}
+      </div>
+      <div id="header_commit_msg_title">Message:</div>
+      <div id="header_commit_msg">{{ rt->commit_msg }}</div>
+    </div>
+    <div class="dotted_line"></div>
+    <div id="tag_commit">
+      {{ "\n" }}
+      {{ rt->tag_commit }}
+    </div>
+  </div>
+</div>
+{{ end }}
+
 {{ define gotweb_render_rss(struct template *tp) }}
 {!
 	struct request		*c = tp->tp_arg;