From 0ba89d75e6e26bf14f5b6cfb6526e601f7ad7e2d Mon Sep 17 00:00:00 2001 From: Eric Sunshine Date: Tue, 13 Jan 2015 04:57:09 -0500 Subject: git.py: introduce Blob abstraction Some blob representations (such as embedded images) require raw blob content, however, the 'blob' view is unconditionally handed cooked (utf8-encoded) content, thus representations which need raw content are forced to reload the blob in raw form, which is ugly and expensive (due to shelling out to git-cat-file a second time). The ultimate goal is to eliminate the wasteful blob reloading when raw content is needed. As a first step, introduce a Blob abstraction to be returned by Repo.blob() rather than the cooked content. A subsequent change will flesh out Blob, allowing it to return raw or cooked content on demand without the client having to specify one or the other when invoking Repo.blob(). Signed-off-by: Eric Sunshine Signed-off-by: Alberto Bertogli --- views/blob.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'views') diff --git a/views/blob.html b/views/blob.html index e44ff99..f744cd9 100644 --- a/views/blob.html +++ b/views/blob.html @@ -42,12 +42,12 @@ % if can_embed_image(repo, fname.unicode): {{!embed_image_blob(repo, dirname.raw, fname.raw)}} % elif can_markdown(repo, fname.unicode): -{{!markdown_blob(blob)}} -% elif can_colorize(blob): -{{!colorize_blob(fname.unicode, blob)}} +{{!markdown_blob(blob.utf8_content)}} +% elif can_colorize(blob.utf8_content): +{{!colorize_blob(fname.unicode, blob.utf8_content)}} % else:
-{{blob}}
+{{blob.utf8_content}}
 
% end -- cgit v1.2.3