aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Sunshine <sunshine@sunshineco.com>2015-01-13 10:57:16 +0100
committerAlberto Bertogli <albertito@blitiri.com.ar>2015-01-13 20:51:45 +0100
commit46640c68b9758b3c76d6a81d5a7c8601b6c4b5ee (patch)
tree1037578ed64c1082279b83ce163195055434423e
parentc91beccdb04f0437ac6cd8f13c09117ea9766296 (diff)
downloadgit-arr-fork-46640c68b9758b3c76d6a81d5a7c8601b6c4b5ee.zip
views: blob: render empty blobs specially
Empty (zero-length) blobs are currently rendered by 'pygments' misleadingly as a single empty line, or, when 'pygments' is unavailable, as "nothingness" preceding a horizontal rule. In either case, it is somewhat difficult to glean concrete information about the blob. Address this by instead rendering summary information about the blob: in particular, its classification ("empty") and its size ("0 bytes"). This is analogous to the summary information rendered for binary blobs ("binary" and size). Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
-rw-r--r--views/blob.html8
1 files changed, 7 insertions, 1 deletions
diff --git a/views/blob.html b/views/blob.html
index 521fe74..ef20328 100644
--- a/views/blob.html
+++ b/views/blob.html
@@ -39,7 +39,13 @@
<a href="">{{!fname.html}}</a>
</h3>
-% if can_embed_image(repo, fname.unicode):
+% if len(blob.raw_content) == 0:
+<table class="nice">
+ <tr>
+ <td>empty &mdash; 0 bytes</td>
+ </tr>
+</table>
+% elif can_embed_image(repo, fname.unicode):
{{!embed_image_blob(fname.raw, blob.raw_content)}}
% elif is_binary(blob.raw_content):
<table class="nice blob-binary">