Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix a problem where non-existing user.name or user.email local config…

… settings caused the script to abort in fix_tags
  • Loading branch information...
commit d9e439d32145b64471d60e05269f05be7981d72f 1 parent db07698
@dzuelke authored
Showing with 5 additions and 4 deletions.
  1. +5 −4 lib/svn2git/migration.rb
View
9 lib/svn2git/migration.rb
@@ -211,8 +211,9 @@ def get_branches
def fix_tags
current = {}
- current['user.name'] = run_command("git config --local --get user.name")
- current['user.email'] = run_command("git config --local --get user.email")
+ # use || true so the command does not fail if no local settings exist
+ current['user.name'] = run_command("git config --local --get user.name || true")
+ current['user.email'] = run_command("git config --local --get user.email || true")
@tags.each do |tag|
tag = tag.strip
@@ -230,10 +231,10 @@ def fix_tags
ensure
current.each_pair do |name, value|
# If a line was read, then there was a config value so restore it.
- # Otherwise unset the value because originally there was none.
+ # Otherwise unset the value because originally there was none, but only if there were any tags (otherwise the command will error)
if value[-1] == "\n"
run_command("git config --local #{name} '#{value.chomp("\n")}'")
- else
+ elsif !@tags.empty?
run_command("git config --local --unset #{name}")
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.