- if (get_sha1(revname, sha1)) {
- cgit_print_error(fmt("Bad tag reference: %s", revname));
- return;
+ if (!revname)
+ revname = ctx.qry.head;
+
+ strbuf_addf(&fullref, "refs/tags/%s", revname);
+ if (get_oid(fullref.buf, &oid)) {
+ cgit_print_error_page(404, "Not found",
+ "Bad tag reference: %s", revname);
+ goto cleanup;