about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ui-tree.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ui-tree.c b/ui-tree.c index 1e4efb2..45e930e 100644 --- a/ui-tree.c +++ b/ui-tree.c
@@ -89,6 +89,7 @@ static void print_object(const struct object_id *oid, const char *path, const ch
89 enum object_type type; 89 enum object_type type;
90 char *buf; 90 char *buf;
91 unsigned long size; 91 unsigned long size;
92 int is_binary;
92 93
93 type = oid_object_info(the_repository, oid, &size); 94 type = oid_object_info(the_repository, oid, &size);
94 if (type == OBJ_BAD) { 95 if (type == OBJ_BAD) {
@@ -103,6 +104,7 @@ static void print_object(const struct object_id *oid, const char *path, const ch
103 "Error reading object %s", oid_to_hex(oid)); 104 "Error reading object %s", oid_to_hex(oid));
104 return; 105 return;
105 } 106 }
107 is_binary = buffer_is_binary(buf, size);
106 108
107 cgit_set_title_from_path(path); 109 cgit_set_title_from_path(path);
108 110
@@ -110,7 +112,7 @@ static void print_object(const struct object_id *oid, const char *path, const ch
110 htmlf("blob: %s (", oid_to_hex(oid)); 112 htmlf("blob: %s (", oid_to_hex(oid));
111 cgit_plain_link("plain", NULL, NULL, ctx.qry.head, 113 cgit_plain_link("plain", NULL, NULL, ctx.qry.head,
112 rev, path); 114 rev, path);
113 if (ctx.repo->enable_blame) { 115 if (ctx.repo->enable_blame && !is_binary) {
114 html(") ("); 116 html(") (");
115 cgit_blame_link("blame", NULL, NULL, ctx.qry.head, 117 cgit_blame_link("blame", NULL, NULL, ctx.qry.head,
116 rev, path); 118 rev, path);
@@ -123,7 +125,7 @@ static void print_object(const struct object_id *oid, const char *path, const ch
123 return; 125 return;
124 } 126 }
125 127
126 if (buffer_is_binary(buf, size)) 128 if (is_binary)
127 print_binary_buffer(buf, size); 129 print_binary_buffer(buf, size);
128 else 130 else
129 print_text_buffer(basename, buf, size); 131 print_text_buffer(basename, buf, size);