diff options
Diffstat (limited to 'git.py')
-rw-r--r-- | git.py | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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() |