From bc8bac5b1915bc6771e916de41deb916447ff879 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 15 Sep 2020 21:03:40 +0100 Subject: 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. --- lorry | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'lorry') 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): -- cgit v1.2.1