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

fall back to "/tmp" if $TMPDIR isn't set

上级 5f806018
......@@ -366,7 +366,7 @@ module Hub
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)}")
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
end
......
......@@ -404,6 +404,13 @@ class HubTest < Test::Unit::TestCase
end
end
def test_am_no_tmpdir
with_tmpdir(nil) do
cmd = Hub("am https://github.com/defunkt/hub/pull/55").command
assert_includes '/tmp/55.patch', cmd
end
end
def test_am_commit_url
with_tmpdir('/tmp/') do
url = 'https://github.com/davidbalbert/hub/commit/fdb9921'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册