Repo.blob: employ formal mechanism for requesting raw command output
Sneakily extracting the raw 'fd' from the utf8-encoding wrapper returned by GitCommand.run() is ugly and fragile. Instead, take advantage of the new formal API for requesting raw command output. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
This commit is contained in:
parent
43f4132bf1
commit
6b83e32bc1
5
git.py
5
git.py
@ -344,6 +344,7 @@ class Repo:
|
|||||||
if not ref:
|
if not ref:
|
||||||
ref = self.branch
|
ref = self.branch
|
||||||
cmd = self.cmd('cat-file')
|
cmd = self.cmd('cat-file')
|
||||||
|
cmd.raw(raw)
|
||||||
cmd.batch = None
|
cmd.batch = None
|
||||||
|
|
||||||
if isinstance(ref, unicode):
|
if isinstance(ref, unicode):
|
||||||
@ -355,10 +356,6 @@ class Repo:
|
|||||||
if not head or head.strip().endswith('missing'):
|
if not head or head.strip().endswith('missing'):
|
||||||
return None
|
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()
|
return out.read()
|
||||||
|
|
||||||
def last_commit_timestamp(self):
|
def last_commit_timestamp(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user