summaryrefslogtreecommitdiff
path: root/morphlib/localrepocache.py
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2012-09-14 09:32:45 +0100
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2012-09-14 17:14:16 +0100
commitdd4f52f311467240ea2749c773d46b751478381d (patch)
treef6939600c12ad695bf375e452657c8e13f2c9bf2 /morphlib/localrepocache.py
parent8d98f5692fb974d081dfb74a64e2f4b861b27461 (diff)
downloadmorph-dd4f52f311467240ea2749c773d46b751478381d.tar.gz
Rework git caches to be bare mirrors of the repos.
This reworks the code for managing and using the git caches in morph to treat the caches as bare repositories which are mirrors of where we clone from. In addition we correctly prune the branches during updates, so that we don't end up accumulating pointless branches over and over. This is even more important with branch-and-merge generating temporary build refs for things.
Diffstat (limited to 'morphlib/localrepocache.py')
-rw-r--r--morphlib/localrepocache.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/morphlib/localrepocache.py b/morphlib/localrepocache.py
index c5a95ebc..89be56c8 100644
--- a/morphlib/localrepocache.py
+++ b/morphlib/localrepocache.py
@@ -197,7 +197,7 @@ class LocalRepoCache(object):
return False, 'Unable to fetch bundle %s: %s' % (bundle_url, e)
try:
- self._git(['clone', '-n', bundle_path, path])
+ self._git(['clone', '--mirror', '-n', bundle_path, path])
self._git(['remote', 'set-url', 'origin', repourl], cwd=path)
except cliapp.AppException, e: # pragma: no cover
if self._exists(path):
@@ -236,7 +236,7 @@ class LocalRepoCache(object):
repourl = self._resolver.pull_url(reponame)
path = self._cache_name(repourl)
try:
- self._git(['clone', '-n', repourl, path])
+ self._git(['clone', '--mirror', '-n', repourl, path])
except cliapp.AppException, e:
errors.append('Unable to clone from %s to %s: %s' %
(repourl, path, e))