From 1514aa48c77b5e7bd3c749ecb6c18e53a96cee2e Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Wed, 26 Aug 2015 09:42:05 -0600 Subject: [PATCH 1/2] Fix --rootistrunk --- lib/svn2git/migration.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/svn2git/migration.rb b/lib/svn2git/migration.rb index bd0f6b2..23883b0 100755 --- a/lib/svn2git/migration.rb +++ b/lib/svn2git/migration.rb @@ -188,7 +188,7 @@ def clone! if nominimizeurl cmd += "--no-minimize-url " end - cmd += "--trunk=#{@url}" + cmd += @url run_command(cmd, true, true) else From 4cf4b6e679dca91eb51a2c9308a95112ec47b64d Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Wed, 26 Aug 2015 11:20:42 -0600 Subject: [PATCH 2/2] Really fix --rootistrunk --- lib/svn2git/migration.rb | 51 +++++++++++++--------------------------- 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/lib/svn2git/migration.rb b/lib/svn2git/migration.rb index 23883b0..eb5b405 100755 --- a/lib/svn2git/migration.rb +++ b/lib/svn2git/migration.rb @@ -45,7 +45,6 @@ def parse(args) options[:verbose] = false options[:metadata] = false options[:nominimizeurl] = false - options[:rootistrunk] = false options[:trunk] = 'trunk' options[:branches] = 'branches' options[:tags] = 'tags' @@ -92,7 +91,6 @@ def parse(args) end opts.on('--rootistrunk', 'Use this if the root level of the repo is equivalent to the trunk and there are no tags or branches') do - options[:rootistrunk] = true options[:trunk] = nil options[:branches] = nil options[:tags] = nil @@ -172,43 +170,28 @@ def clone! tags = @options[:tags] metadata = @options[:metadata] nominimizeurl = @options[:nominimizeurl] - rootistrunk = @options[:rootistrunk] authors = @options[:authors] exclude = @options[:exclude] revision = @options[:revision] username = @options[:username] password = @options[:password] - if rootistrunk - # Non-standard repository layout. The repository root is effectively 'trunk.' - cmd = "git svn init --prefix=svn/ " - cmd += "--username=#{username} " unless username.nil? - cmd += "--password=#{password} " unless password.nil? - cmd += "--no-metadata " unless metadata - if nominimizeurl - cmd += "--no-minimize-url " - end - cmd += @url - run_command(cmd, true, true) + cmd = "git svn init --prefix=svn/ " - else - cmd = "git svn init --prefix=svn/ " - - # Add each component to the command that was passed as an argument. - cmd += "--username=#{username} " unless username.nil? - cmd += "--password=#{password} " unless password.nil? - cmd += "--no-metadata " unless metadata - if nominimizeurl - cmd += "--no-minimize-url " - end - cmd += "--trunk=#{trunk} " unless trunk.nil? - cmd += "--tags=#{tags} " unless tags.nil? - cmd += "--branches=#{branches} " unless branches.nil? + # Add each component to the command that was passed as an argument. + cmd += "--username=#{username} " unless username.nil? + cmd += "--password=#{password} " unless password.nil? + cmd += "--no-metadata " unless metadata + if nominimizeurl + cmd += "--no-minimize-url " + end + cmd += "--trunk=#{trunk} " unless trunk.nil? + cmd += "--tags=#{tags} " unless tags.nil? + cmd += "--branches=#{branches} " unless branches.nil? - cmd += @url + cmd += @url - run_command(cmd, true, true) - end + run_command(cmd, true, true) run_command("#{git_config_command} svn.authorsfile #{authors}") unless authors.nil? @@ -222,11 +205,9 @@ def clone! # Add exclude paths to the command line; some versions of git support # this for fetch only, later also for init. regex = [] - unless rootistrunk - regex << "#{trunk}[/]" unless trunk.nil? - regex << "#{tags}[/][^/]+[/]" unless tags.nil? - regex << "#{branches}[/][^/]+[/]" unless branches.nil? - end + regex << "#{trunk}[/][^/]+[/]" unless trunk.nil? || trunk == '/' + regex << "#{tags}[/][^/]+[/]" unless tags.nil? + regex << "#{branches}[/][^/]+[/]" unless branches.nil? regex = '^(?:' + regex.join('|') + ')(?:' + exclude.join('|') + ')' cmd += "'--ignore-paths=#{regex}'" end