提交 76d84686 编写于 作者: M Mislav Marohnić

careful, ARGV items are frozen

上级 7e804aae
......@@ -374,11 +374,11 @@ module Hub
idx = args.index(url)
gist = $1 == 'gist.'
# strip the fragment part of the url
url.sub!(/#.+/, '')
url = url.sub(/#.+/, '')
# strip extra path from "pull/42/files", "pull/42/commits"
url.sub!(%r{(/pull/\d+)/\w*$}, '\1') unless gist
url = url.sub(%r{(/pull/\d+)/\w*$}, '\1') unless gist
ext = gist ? '.txt' : '.patch'
url << ext unless File.extname(url) == ext
url += ext unless File.extname(url) == ext
patch_file = File.join(ENV['TMPDIR'] || '/tmp', "#{gist ? 'gist-' : ''}#{File.basename(url)}")
args.before 'curl', ['-#LA', "hub #{Hub::Version}", url, '-o', patch_file]
args[idx] = patch_file
......
......@@ -16,7 +16,7 @@ class Test::Unit::TestCase
# shell: hub clone rtomayko/tilt
# test: Hub("clone rtomayko/tilt")
def Hub(args)
Hub::Runner.new(*args.split(' '))
Hub::Runner.new(*args.split(' ').map {|a| a.freeze })
end
# Shortcut for running the `hub` command in a subprocess. Returns
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册