From 0ca61d4c68dad68901f8a7364dd210ef27a8b4c6 Mon Sep 17 00:00:00 2001 From: Eric Jonas Date: Wed, 14 Jan 2009 22:51:40 -0500 Subject: Fixed the gzip archive creation using python gzip module (cherry picked from commit 160bd2bb74d88c110874c21635e24cc74ef58459) --- lib/git/repo.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/git/repo.py') diff --git a/lib/git/repo.py b/lib/git/repo.py index 2d0fb973..da18208c 100644 --- a/lib/git/repo.py +++ b/lib/git/repo.py @@ -6,6 +6,8 @@ import os import re +import gzip +import StringIO from errors import InvalidGitRepositoryError, NoSuchPathError from utils import touch, is_git_dir from cmd import Git @@ -386,7 +388,12 @@ class Repo(object): kwargs = {} if prefix: kwargs['prefix'] = prefix - self.git.archive(treeish, "| gzip", **kwargs) + resultstr = self.git.archive(treeish, **kwargs) + sio = StringIO.StringIO() + gf = gzip.GzipFile(fileobj=sio, mode ='wb') + gf.write(resultstr) + gf.close() + return sio.getvalue() def _get_daemon_export(self): filename = os.path.join(self.path, self.DAEMON_EXPORT_FILE) -- cgit v1.2.1