nirvdrum / svn2git

Ruby tool for importing existing svn projects into git.
MIT License
2.11k stars 443 forks source link

svn2git fails if branch contains shell special characters #18

Closed p3k closed 12 years ago

p3k commented 13 years ago

Running svn2git --rebase on a previously converted repository of http://antville.googlecode.com/svn shows the following output:

Switched to branch 'Juliette'
sh: Syntax error: "(" unexpected
sh: Syntax error: "(" unexpected
Switched to branch 'antville_1_0'
...
Switched to branch 'master'
Counting objects: 29403, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (7614/7614), done.
Writing objects: 100% (29403/29403), done.
Total 29403 (delta 21404), reused 29403 (delta 21404)

As far as I can see there is a branch juliette but not Juliette (with upper-case J).

What could be the reason for the Syntax error? Obviously the command itself does not fail, so can I ignore this?

nirvdrum commented 13 years ago

Could you try running with the --verbose flag and reporting back? It'd help see where the syntax error is raised at the very least.

sleicht commented 12 years ago

this happens if a svn-branch has a "(" in the name. This can be solved if the commands "git branch --track..." and "git checkout..." are "("-saved.

line 234-247:

      svn_branches.each do |branch|
        branch = branch.gsub(/^svn\//,'').strip
        if @options[:rebase] && (@local.include?(branch) || branch == 'trunk')
           lbranch = branch
           lbranch = 'master' if branch == 'trunk'
           run_command("git checkout -f \"#{lbranch}\"")
           run_command("git rebase remotes/svn/#{branch}")
           next
        end
        next if branch == 'trunk' || @local.include?(branch)
        run_command("git branch --track \"#{branch}\" \"remotes/svn/#{branch}\"")
        run_command("git checkout \"#{branch}\"")
      end
nirvdrum commented 12 years ago

I almost completely missed this. In the future, please issue a pull request when you have a patch. It makes it a lot easier to keep track of things (and give proper attribution when merged).

sleicht commented 12 years ago

Will do (pull requests). Thanks a lot!