diff options
Diffstat (limited to 'lorry')
-rwxr-xr-x | lorry | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -287,9 +287,26 @@ class Lorry(cliapp.Application): self.progress('.. initialising git dir') self.run_program(['git', 'init', '--bare', gitdir]) self.progress('.. updating existing clone') - self.run_program(['git', 'fetch', spec['url'], - '+refs/heads/*:refs/heads/*', + if 'remote.origin.fetch' in self.run_program(['git', 'config', '-l'], + cwd=gitdir): + self.run_program(['git', 'config', '--unset-all', + 'remote.origin.fetch'], cwd=gitdir) + self.run_program(['git', 'config', 'remote.origin.url', + spec['url']], cwd=gitdir) + self.run_program(['git', 'config', 'remote.origin.mirror', 'true'], + cwd=gitdir) + self.run_program(['git', 'config', '--add', 'remote.origin.fetch', + '+refs/heads/*:refs/heads/*'], cwd=gitdir) + self.run_program(['git', 'config', '--add', 'remote.origin.fetch', '+refs/tags/*:refs/tags/*'], cwd=gitdir) + try: + self.run_program(['git', 'remote', 'update', 'origin', '--prune'], + cwd=gitdir) + except: + self.run_program(['git', 'remote', 'prune', 'origin'], + cwd=gitdir) + self.run_program(['git', 'remote', 'update', 'origin', '--prune'], + cwd=gitdir) def gitify_bzr(self, project_name, dirname, gitdir, spec): bzrdir = os.path.join(dirname, 'bzr') |