Skip to content

Commit d8b519b

Browse files
sagirusergiomb2
authored andcommitted
Support different localized git messages
git2svn sometimes parses the stdout of git commands but if the locale is not set to something like en_US it can't and fails with the following error: Running command: git branch --track "<branch>" "remotes/svn/<branch>" fatal: No se puede configurar el rastreo de información; el punto de partida 'remotes/svn/1.0' no es una rama. ******************************************************************** svn2git warning: Tracking remote SVN branches is deprecated. In a future release local branches will be created without tracking. If you must resync your branches, run: svn2git --rebase ******************************************************************** Running command: git checkout "<branch>" error: pathspec '<branch>' did not match any file(s) known to git. command failed: ... A comparable error for 'git config' happened if a older version of git (< 1.7.4) will be used. It's never a good idea to parse messages from stdout in a special language but this simple fix parse the messages in the same manner and should support different languages.
1 parent 6dac85a commit d8b519b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/svn2git/migration.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ def fix_branches
357357
# Our --rebase option obviates the need for read-only tracked remotes, however. So, we'll
358358
# deprecate the old option, informing those relying on the old behavior that they should
359359
# use the newer --rebase otion.
360-
if status =~ /Cannot setup tracking information/m
360+
if status =~ /fatal:.+'#{branch}'.+/
361361
@cannot_setup_tracking_information = true
362362
run_command(Svn2Git::Migration.checkout_svn_branch(branch))
363363
else
@@ -476,7 +476,7 @@ def git_config_command
476476
if @git_config_command.nil?
477477
status = run_command('git config --local --get user.name', false)
478478

479-
@git_config_command = if status =~ /unknown option/m
479+
@git_config_command = if status =~ /error: .+\s.+git config \[.+/m
480480
'git config'
481481
else
482482
'git config --local'
@@ -488,4 +488,3 @@ def git_config_command
488488

489489
end
490490
end
491-

0 commit comments

Comments
 (0)