From 63c3fa601f27a6a93473467e212cefc38d89dbd4 Mon Sep 17 00:00:00 2001 From: quimicefa Date: Tue, 12 Jan 2021 20:04:52 +0100 Subject: [PATCH] fixed comma setup this allow to parse tags/branches containing ${} characters, without raising "sh: svn/tags/${version.tecnica}: bad substitution" errors. --- lib/svn2git/migration.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/svn2git/migration.rb b/lib/svn2git/migration.rb index 4de8a9e..10945fc 100755 --- a/lib/svn2git/migration.rb +++ b/lib/svn2git/migration.rb @@ -295,21 +295,22 @@ def fix_tags @tags.each do |tag| tag = tag.strip id = tag.gsub(%r{^svn\/tags\/}, '').strip - subject = run_command("git log -1 --pretty=format:'%s' \"#{escape_quotes(tag)}\"").chomp("'").reverse.chomp("'").reverse - date = run_command("git log -1 --pretty=format:'%ci' \"#{escape_quotes(tag)}\"").chomp("'").reverse.chomp("'").reverse - author = run_command("git log -1 --pretty=format:'%an' \"#{escape_quotes(tag)}\"").chomp("'").reverse.chomp("'").reverse - email = run_command("git log -1 --pretty=format:'%ae' \"#{escape_quotes(tag)}\"").chomp("'").reverse.chomp("'").reverse + subject = run_command("git log -1 --pretty=format:'%s' \'#{escape_quotes(tag)}\'").chomp("'").reverse.chomp("'").reverse + date = run_command("git log -1 --pretty=format:'%ci' \'#{escape_quotes(tag)}\'").chomp("'").reverse.chomp("'").reverse + author = run_command("git log -1 --pretty=format:'%an' \'#{escape_quotes(tag)}\'").chomp("'").reverse.chomp("'").reverse + email = run_command("git log -1 --pretty=format:'%ae' \'#{escape_quotes(tag)}\'").chomp("'").reverse.chomp("'").reverse run_command("#{git_config_command} user.name \"#{escape_quotes(author)}\"") run_command("#{git_config_command} user.email \"#{escape_quotes(email)}\"") original_git_committer_date = ENV['GIT_COMMITTER_DATE'] ENV['GIT_COMMITTER_DATE'] = escape_quotes(date) - run_command("git tag -a -m \"#{escape_quotes(subject)}\" \"#{escape_quotes(id)}\" \"#{escape_quotes(tag)}\"") + run_command("git tag -a -m \'#{escape_quotes(subject)}\' \'#{escape_quotes(id)}\' \'#{escape_quotes(tag)}\'") ENV['GIT_COMMITTER_DATE'] = original_git_committer_date - run_command("git branch -d -r \"#{escape_quotes(tag)}\"") + run_command("git branch -d -r \'#{escape_quotes(tag)}\'") end + ensure # We only change the git config values if there are @tags available. So it stands to reason we should revert them only in that case. unless @tags.empty?