From: june at causal.agency (C. McEnroe)
Subject: [PATCH 2/2] ui-tree: don't link to blame for binary blobs
Date: Wed, 18 Dec 2019 16:52:31 -0500 [thread overview]
Message-ID: <20191218215231.10961-2-june@causal.agency> (raw)
In-Reply-To: <20191218215231.10961-1-june@causal.agency>
---
ui-tree.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/ui-tree.c b/ui-tree.c
index 84eb17d..c4f2dac 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
enum object_type type;
char *buf;
unsigned long size;
+ int is_binary;
type = oid_object_info(the_repository, oid, &size);
if (type == OBJ_BAD) {
@@ -103,6 +104,7 @@ static void print_object(const struct object_id *oid, const char *path, const ch
"Error reading object %s", oid_to_hex(oid));
return;
}
+ is_binary = buffer_is_binary(buf, size);
cgit_set_title_from_path(path);
@@ -110,7 +112,7 @@ static void print_object(const struct object_id *oid, const char *path, const ch
htmlf("blob: %s (", oid_to_hex(oid));
cgit_plain_link("plain", NULL, NULL, ctx.qry.head,
rev, path);
- if (ctx.repo->enable_blame) {
+ if (ctx.repo->enable_blame && !is_binary) {
html(") (");
cgit_blame_link("blame", NULL, NULL, ctx.qry.head,
rev, path);
@@ -123,7 +125,7 @@ static void print_object(const struct object_id *oid, const char *path, const ch
return;
}
- if (buffer_is_binary(buf, size))
+ if (is_binary)
print_binary_buffer(buf, size);
else
print_text_buffer(basename, buf, size);
--
2.23.0
prev parent reply other threads:[~2019-12-18 21:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-18 21:52 [PATCH 1/2] ui-blame: bail if blob is binary june
2019-12-18 21:52 ` june [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191218215231.10961-2-june@causal.agency \
--to=cgit@lists.zx2c4.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).