Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct escaping of quotes and double quotes. (#89, #86) #93

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/svn2git/migration.rb
Expand Up @@ -330,7 +330,7 @@ def verify_working_tree_is_clean
end

def escape_quotes(str)
str.gsub("'", "'\\\\''")
str.gsub("'", "\\\\'").gsub('"', '\\\\"')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alternatively it could be also used:
str.gsub(/'|"/) { |c| "\\#{c}" }
which is probably nicer looking.

should backslashes \ also be escaped?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to use this for now. I tried to replace everything with Shellwords and even backported it for Ruby 1.8 support, but Shellwords doesn't work on Windows. I'm still evaluating options there, but in the meanwhile I'll fix the quote escaping.

end

end
Expand Down