summaryrefslogtreecommitdiff
path: root/morphlib/git.py
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2012-11-12 15:58:27 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2012-11-12 17:09:44 +0000
commita5b913a83db94380fc91d15571f55cbf7b5c741b (patch)
tree9d03bffd2d010ec8f554c06e86cf2adb8bf1f632 /morphlib/git.py
parent1cc7a313d4a7c4dd348da1aab0e3b6108b6b48b9 (diff)
downloadmorph-a5b913a83db94380fc91d15571f55cbf7b5c741b.tar.gz
Avoid caching repos that are on the local machine anyway
Currently the message is still displayed "Updating xxx" but no update is actually done.
Diffstat (limited to 'morphlib/git.py')
-rw-r--r--morphlib/git.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/morphlib/git.py b/morphlib/git.py
index 973e4af7..7985b815 100644
--- a/morphlib/git.py
+++ b/morphlib/git.py
@@ -175,13 +175,18 @@ def set_remote(runcmd, gitdir, name, url):
return runcmd(['git', 'remote', 'set-url', name, url], cwd=gitdir)
-def copy_repository(runcmd, repo, destdir):
+def copy_repository(runcmd, repo, destdir, is_mirror=True):
'''Copies a cached repository into a directory using cp.
This also fixes up the repository afterwards, so that it can contain
code etc. It does not leave any given branch ready for use.
'''
+ if is_mirror == False:
+ runcmd(['cp', '-a', os.path.join(repo, '.git'),
+ os.path.join(destdir, '.git')])
+ return
+
runcmd(['cp', '-a', repo, os.path.join(destdir, '.git')])
# core.bare should be false so that git believes work trees are possible
runcmd(['git', 'config', 'core.bare', 'false'], cwd=destdir)