]> git.cameronkatri.com Git - cgit.git/blobdiff - ui-tree.c
ui-refs: use shared function to print tag downloads
[cgit.git] / ui-tree.c
index 39258092b44f4279db445378da3361e0d6593326..524de0fc30d91caa8305cfd4ba40e74110b6a5f2 100644 (file)
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -1,6 +1,6 @@
 /* ui-tree.c: functions for tree output
  *
- * Copyright (C) 2006-2014 cgit Development Team <cgit@lists.zx2c4.com>
+ * Copyright (C) 2006-2017 cgit Development Team <cgit@lists.zx2c4.com>
  *
  * Licensed under GNU General Public License v2
  *   (see COPYING for full license text)
@@ -110,6 +110,11 @@ static void print_object(const unsigned char *sha1, char *path, const char *base
        htmlf("blob: %s (", sha1_to_hex(sha1));
        cgit_plain_link("plain", NULL, NULL, ctx.qry.head,
                        rev, path);
+       if (ctx.cfg.enable_blame) {
+               html(") (");
+               cgit_blame_link("blame", NULL, NULL, ctx.qry.head,
+                               rev, path);
+       }
        html(")\n");
 
        if (ctx.cfg.max_blob_size && size / 1024 > ctx.cfg.max_blob_size) {
@@ -122,6 +127,8 @@ static void print_object(const unsigned char *sha1, char *path, const char *base
                print_binary_buffer(buf, size);
        else
                print_text_buffer(basename, buf, size);
+
+       free(buf);
 }
 
 struct single_tree_ctx {
@@ -244,6 +251,9 @@ static int ls_item(const unsigned char *sha1, struct strbuf *base,
        if (!S_ISGITLINK(mode))
                cgit_plain_link("plain", NULL, "button", ctx.qry.head,
                                walk_tree_ctx->curr_rev, fullpath.buf);
+       if (!S_ISDIR(mode) && ctx.cfg.enable_blame)
+               cgit_blame_link("blame", NULL, "button", ctx.qry.head,
+                               walk_tree_ctx->curr_rev, fullpath.buf);
        html("</td></tr>\n");
        free(name);
        strbuf_release(&fullpath);