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

`am` strips extra path from pull reqs URLs such as "pull/42/files"

上级 1fb38534
......@@ -236,6 +236,8 @@ module Hub
if url = args.find { |a| a =~ %r{^https?://(gist\.)?github\.com/} }
idx = args.index(url)
gist = $1 == 'gist.'
# strip extra path from "pull/42/files", "pull/42/commits"
url = url.sub(%r{(/pull/\d+)/\w*$}, '\1') unless gist
ext = gist ? '.txt' : '.patch'
url += ext unless File.extname(url) == ext
patch_file = File.join(ENV['TMPDIR'], "#{gist ? 'gist-' : ''}#{File.basename(url)}")
......
......@@ -360,6 +360,9 @@ class HubTest < Test::Unit::TestCase
assert_commands "curl -#LA 'hub #{Hub::Version}' https://github.com/defunkt/hub/pull/55.patch -o /tmp/55.patch",
"git am --signoff /tmp/55.patch -p2",
"am --signoff https://github.com/defunkt/hub/pull/55 -p2"
cmd = Hub("am https://github.com/defunkt/hub/pull/55/files").command
assert_includes '/pull/55.patch', cmd
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册