Skip to content

Commit 0ca61d4

Browse files
ericmjonasempty
authored andcommitted
Fixed the gzip archive creation using python gzip module
(cherry picked from commit 160bd2bb74d88c110874c21635e24cc74ef58459)
1 parent 5f23379 commit 0ca61d4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

‎lib/git/repo.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
import os
88
import re
9+
import gzip
10+
import StringIO
911
from errors import InvalidGitRepositoryError, NoSuchPathError
1012
from utils import touch, is_git_dir
1113
from cmd import Git
@@ -386,7 +388,12 @@ def archive_tar_gz(self, treeish='master', prefix=None):
386388
kwargs = {}
387389
if prefix:
388390
kwargs['prefix'] = prefix
389-
self.git.archive(treeish, "| gzip", **kwargs)
391+
resultstr = self.git.archive(treeish, **kwargs)
392+
sio = StringIO.StringIO()
393+
gf = gzip.GzipFile(fileobj=sio, mode ='wb')
394+
gf.write(resultstr)
395+
gf.close()
396+
return sio.getvalue()
390397

391398
def _get_daemon_export(self):
392399
filename = os.path.join(self.path, self.DAEMON_EXPORT_FILE)

0 commit comments

Comments
 (0)