summaryrefslogtreecommitdiff
path: root/lorry
diff options
context:
space:
mode:
Diffstat (limited to 'lorry')
-rwxr-xr-xlorry34
1 files changed, 16 insertions, 18 deletions
diff --git a/lorry b/lorry
index 59d8296..524ed2c 100755
--- a/lorry
+++ b/lorry
@@ -479,7 +479,7 @@ class Lorry(cliapp.Application):
if active_count == 0:
# We can't create the repo here because "git cvsimport"
- # and "git svn init" insist on doing so themselves
+ # insists on doing so itself
return temp_repo, None, 1
self.copy_gitdir(active_repo, temp_repo)
@@ -621,24 +621,22 @@ class Lorry(cliapp.Application):
layout = { "trunk": "trunk",
"tags": "tags/*",
"branches": "branches/*" }
- if not os.path.exists(gitdir):
- self.progress('.. doing initial clone')
- self.needs_aggressive = True
- self.run_program(['git', 'svn', 'init', spec['url'], gitdir + "-tmp",
- '--svn-remote=svn', '--no-minimize-url'])
- os.rename(os.path.join(gitdir + "-tmp", '.git'), gitdir)
- os.rmdir(gitdir + "-tmp")
- self.run_program(['git', 'config', 'core.bare', 'true'],
- cwd=gitdir)
- else:
- self.progress('.. updating existing clone')
- # Force URL to the one in the Lorry spec. This way, if the
- # URL in the spec changes, Lorry accepts the change rather
- # than using the original one.
- self.run_program(
- ['git', 'config', 'svn-remote.svn.url', spec['url']],
- cwd=gitdir)
+ # We should not run "git svn init" which creates a non-bare
+ # repository. Instead, create the directory and extra config
+ # parameters that it would create. This also ensures that if
+ # the URL in the spec changes, Lorry accepts the change rather
+ # than using the original one.
+ self.needs_aggressive = self.ensure_gitdir(gitdir)
+ os.makedirs(os.path.join(gitdir, 'svn/refs/remotes/git-svn'),
+ exist_ok=True)
+ self.run_program(
+ ['git', 'config', 'svn-remote.svn.url', spec['url']],
+ cwd=gitdir)
+ self.run_program(
+ ['git', 'config', 'svn-remote.svn.fetch', ':refs/remotes/git-svn'],
+ cwd=gitdir)
+
# manually set the refspecs to fetch into local
# git-svn can apparently provide better history tracking by
# fetching the root of the repository