Diff options
Diffstat (limited to 'source/ui-blame.c')
-rw-r--r--source/ui-blame.c24
1 file changed, 9 insertions, 15 deletions
diff --git a/source/ui-blame.c b/source/ui-blame.c
index efa9470..32a76fa 100644
--- a/source/ui-blame.c
+++ b/source/ui-blame.c
@@ -277,6 +277,7 @@ static void print_blame_page(const struct object_id *oid, const char *path,
size_t size;
struct rev_info revs;
struct blame_scoreboard sb;
+ int binary;
type = odb_read_object_info(the_repository->objects, oid, &size);
if (type == OBJ_BAD) {
@@ -295,7 +296,13 @@ static void print_blame_page(const struct object_id *oid, const char *path,
return;
}
- run_blame(&sb, &revs, path, rev);
+ // A NUL past the window buffer_is_binary sniffs would end a Lua
+ // filter's output early while the hash and line number columns still
+ // cover the whole file, so a blob holding one anywhere is treated as
+ // binary too.
+ binary = buffer_is_binary(buf, size) || memchr(buf, 0, size);
+ if (!binary)
+ run_blame(&sb, &revs, path, rev);
cgit_set_title_from_path(path);
cgit_prefix_title("blame");
@@ -307,20 +314,7 @@ static void print_blame_page(const struct object_id *oid, const char *path,
cgit_tree_link("tree", NULL, NULL, ctx.qry.head, rev, path);
html(")</div>\n");
- // A NUL past the window buffer_is_binary sniffs would end a Lua
- // filter's output early while the hash and line number columns still
- // cover the whole file, so a blob holding one anywhere is treated as
- // binary too.
- if (buffer_is_binary(buf, size) || memchr(buf, 0, size)) {
- struct blame_entry *ent = sb.ent, *next;
-
- // The scoreboard is normally consumed by the column passes,
- // so this early exit has to release it itself.
- for (; ent; ent = next) {
- next = ent->next;
- free(ent);
- }
- free((void *)sb.final_buf);
+ if (binary) {
html("<div class='error'>Blob is binary</div>");
goto cleanup;
}