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 <a...@warmcat.com>
---
 ui-tree.c |    7 ++++---
 1 file 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;

_______________________________________________
CGit mailing list
CGit@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/cgit

Reply via email to