summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Green <andy@warmcat.com>2018-06-13 10:02:10 +0800
committerChristian Hesse <mail@eworm.de>2018-06-13 10:32:44 +0200
commit14285ad3f37e54ae25bf93e877361dcbae16fe79 (patch)
tree7562479fb2188a1f751de254ef8ee64177cc65a7
parent9a7fb67f6a308a2343e8d50a2df07dd11a89d95b (diff)
downloadcgit-14285ad3f37e54ae25bf93e877361dcbae16fe79.tar.gz
ui-tree: print_object: add is_inline param
We will reuse print_object to render things inline shortly. Add a parameter that lets us adapt its behaviour slightly for that case. Signed-off-by: Andy Green <andy@warmcat.com>
-rw-r--r--ui-tree.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ui-tree.c b/ui-tree.c
index fe5dc75..bb10b17 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -158,7 +158,7 @@ static void include_file(const unsigned char *sha1, const char *path,
}
static void print_object(const unsigned char *sha1, char *path, const char *basename,
- const char *rev, bool use_render)
+ const char *rev, bool use_render, bool is_inline)
{
enum object_type type;
struct cgit_filter *render;
@@ -191,7 +191,8 @@ static void print_object(const unsigned char *sha1, char *path, const char *base
if (!render && !mimetype)
use_render = false;
- cgit_print_layout_start();
+ if (!is_inline)
+ cgit_print_layout_start();
htmlf("blob: %s (", sha1_to_hex(sha1));
cgit_plain_link("plain", NULL, NULL, ctx.qry.head,
rev, path);
@@ -415,7 +416,7 @@ static int walk_tree(const unsigned char *sha1, struct strbuf *base,
} else {
walk_tree_ctx->state = 2;
print_object(sha1, buffer.buf, pathname, walk_tree_ctx->curr_rev,
- walk_tree_ctx->use_render);
+ walk_tree_ctx->use_render, 0);
strbuf_release(&buffer);
return 0;