summaryrefslogtreecommitdiff
path: root/lorry
diff options
context:
space:
mode:
authorBen Hutchings <ben.hutchings@codethink.co.uk>2020-09-15 21:03:40 +0100
committerBen Hutchings <ben.hutchings@codethink.co.uk>2020-09-15 21:31:40 +0100
commitbc8bac5b1915bc6771e916de41deb916447ff879 (patch)
tree37b36b64449f18e4e90115f1e6c9f09e18fb08f2 /lorry
parent7f1d7cffb1bf269f819689a88fda44efb45128eb (diff)
downloadlorry-bc8bac5b1915bc6771e916de41deb916447ff879.tar.gz
lorry: Create bare repository in gitify_cvs
Since commit 50383f3bcce7 "lorry: Crash-proof updates to working git repos with A/B switching", prepare_working_repos assumes that the existing working repositories are bare. Most gitify functions ensure that, but gitify_cvs does not. * Specify the git directory to "git cvsimport" using $GIT_DIR, not the -C option (which specifies a working tree) * Add the -i option to inhibit it from checking out a working tree * Delete any index file that it creates Closes #12.
Diffstat (limited to 'lorry')
-rwxr-xr-xlorry11
1 files changed, 9 insertions, 2 deletions
diff --git a/lorry b/lorry
index 279a175..59d8296 100755
--- a/lorry
+++ b/lorry
@@ -681,11 +681,18 @@ class Lorry(cliapp.Application):
self.needs_aggressive = True
env = dict(os.environ)
env['CVS_RSH'] = 'lorry-ssh-wrapper'
+ env['GIT_DIR'] = gitdir
self.run_program(
- ['git', 'cvsimport', '-a', '-d', spec['url'],
- '-C', gitdir, spec['module']],
+ ['git', 'cvsimport', '-a', '-d', spec['url'],
+ '-i', spec['module']],
env=env)
+ # git cvsimport may create an index even in a bare repo
+ try:
+ os.remove(os.path.join(gitdir, 'index'))
+ except FileNotFoundError:
+ pass
+
def gitify_hg(self, project_name, dirname, gitdir, spec):
cert_options = []
if not self.should_check_certificates(spec):