From 21522f8a3a4a010ad717f5bdcbbc6584d9ba7527 Mon Sep 17 00:00:00 2001 From: Vanya Sergeev Date: Sun, 13 Oct 2013 06:30:25 -0700 Subject: Add embed data URI image blob support --- git.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'git.py') diff --git a/git.py b/git.py index f0e73ba..deddeba 100644 --- a/git.py +++ b/git.py @@ -325,7 +325,7 @@ class Repo: ref = self.branch return Tree(self, ref) - def blob(self, path, ref = None): + def blob(self, path, ref = None, raw = False): """Returns the contents of the given path.""" if not ref: ref = self.branch @@ -341,6 +341,10 @@ class Repo: if not head or head.strip().endswith('missing'): return None + # Raw option in case we need a binary blob and not a utf-8 encoded one. + if raw: + return out.fd.read() + return out.read() -- cgit v1.2.3