summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-02-02 15:29:18 +0000
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-02-02 15:29:18 +0000
commit764e536e00100a57d4c3ea5e0d48336633c28378 (patch)
tree9b1258e7739b860bbf5e63314ab1981cc9cd682d
parentc9d1c2d25370d4a12a8e6a575cce4e48338f8866 (diff)
downloadmorph-764e536e00100a57d4c3ea5e0d48336633c28378.tar.gz
Set GIT_DIR when running git archive. Drop --remote.
This change is necessary because upstream git no longer allows --remote to be combined with an arbitrary SHA1.
-rw-r--r--morphlib/builder.py3
-rw-r--r--morphlib/git.py8
2 files changed, 6 insertions, 5 deletions
diff --git a/morphlib/builder.py b/morphlib/builder.py
index 396aa827..a9004a33 100644
--- a/morphlib/builder.py
+++ b/morphlib/builder.py
@@ -311,7 +311,8 @@ class ChunkBuilder(BlobBuilder):
self.dump_memory_profile('before creating source and tarball '
'for chunk')
tarball = self.cache_prefix + '.src.tar'
- morphlib.git.export_sources(self.blob.morph.treeish, tarball)
+ morphlib.git.export_sources(self.blob.morph.treeish, tarball,
+ msg=self.msg)
self.dump_memory_profile('after exporting sources')
os.mkdir(self.builddir)
self.ex.runv(['tar', '-C', self.builddir, '-xf', tarball])
diff --git a/morphlib/git.py b/morphlib/git.py
index e49c2b0f..9a03dbed 100644
--- a/morphlib/git.py
+++ b/morphlib/git.py
@@ -87,11 +87,11 @@ class Treeish(object):
except (TypeError, morphlib.execute.CommandFailure):
raise InvalidTreeish(self.original_repo, ref)
-def export_sources(treeish, tar_filename):
+def export_sources(treeish, tar_filename, msg=logging.debug):
'''Export the contents of a specific commit into a compressed tarball.'''
- ex = morphlib.execute.Execute('.', msg=logging.debug)
- ex.runv(['git', 'archive', '-o', tar_filename, '--remote',
- 'file://%s' % treeish.repo, treeish.sha1])
+ ex = morphlib.execute.Execute('.', msg=msg)
+ ex.env['GIT_DIR'] = os.path.join(treeish.repo, '.git')
+ ex.runv(['git', 'archive', '-o', tar_filename, treeish.sha1])
def get_morph_text(treeish, filename, msg=logging.debug):
'''Return a morphology from a git repository.'''