Skip to content
Browse files

Fix a problem where non-existing or local config…

… settings caused the script to abort in fix_tags
  • Loading branch information...
1 parent db07698 commit d9e439d32145b64471d60e05269f05be7981d72f @dzuelke committed
Showing with 5 additions and 4 deletions.
  1. +5 −4 lib/svn2git/migration.rb
9 lib/svn2git/migration.rb
@@ -211,8 +211,9 @@ def get_branches
def fix_tags
current = {}
- current[''] = run_command("git config --local --get")
- current[''] = run_command("git config --local --get")
+ # use || true so the command does not fail if no local settings exist
+ current[''] = run_command("git config --local --get || true")
+ current[''] = run_command("git config --local --get || true")
@tags.each do |tag|
tag = tag.strip
@@ -230,10 +231,10 @@ def fix_tags
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}")

0 comments on commit d9e439d

Please sign in to comment.
Something went wrong with that request. Please try again.