Permalink
Browse files

careful, ARGV items are frozen

  • Loading branch information...
1 parent 7e804aa commit 76d8468673ebe5b9fdb413a2e7ad4d9e2a0e408c @mislav mislav committed Jan 28, 2012
Showing with 4 additions and 4 deletions.
  1. +3 −3 lib/hub/commands.rb
  2. +1 −1 test/helper.rb
View
@@ -374,11 +374,11 @@ def am(args)
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
View
@@ -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

0 comments on commit 76d8468

Please sign in to comment.