Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

careful, ARGV items are frozen

  • Loading branch information...
commit 76d8468673ebe5b9fdb413a2e7ad4d9e2a0e408c 1 parent 7e804aa
@mislav mislav authored
Showing with 4 additions and 4 deletions.
  1. +3 −3 lib/hub/commands.rb
  2. +1 −1  test/helper.rb
View
6 lib/hub/commands.rb
@@ -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
2  test/helper.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.