aboutsummaryrefslogtreecommitdiff
path: root/git.py
diff options
context:
space:
mode:
Diffstat (limited to 'git.py')
-rw-r--r--git.py6
1 files changed, 5 insertions, 1 deletions
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()