Skip to content

Commit

Permalink
careful, ARGV items are frozen
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed Jan 28, 2012
1 parent 7e804aa commit 76d8468
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/hub/commands.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/helper.rb
Expand Up @@ -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
Expand Down

0 comments on commit 76d8468

Please sign in to comment.