提交 77fe52b9 编写于 作者: J Jingwen Owen Ou

Merge remote-tracking branch 'origin/master' into merge_master

......@@ -94,7 +94,7 @@ Feature: hub clone
Scenario: Preview cloning a private repo
When I successfully run `hub --noop clone -p rtomayko/ronn`
Then the output should contain exactly "git clone git@github.com:rtomayko/ronn.git\n"
But "git clone" should not be run
But it should not clone anything
Scenario: Clone a private repo
When I successfully run `hub clone -p rtomayko/ronn`
......@@ -137,6 +137,18 @@ Feature: hub clone
Then "git clone git@github.com:sstephenson/rbenv.git" should be run
And there should be no output
Scenario: Preview cloning a repo I have push access to
Given the GitHub API server:
"""
get('/repos/sstephenson/rbenv') {
json :private => false,
:permissions => { :push => true }
}
"""
When I successfully run `hub --noop clone sstephenson/rbenv`
Then the output should contain exactly "git clone git@github.com:sstephenson/rbenv.git\n"
But it should not clone anything
Scenario: Clone my Enterprise repo
Given I am "mifi" on git.my.org with OAuth token "FITOKEN"
And $GITHUB_HOST is "git.my.org"
......
......@@ -141,8 +141,12 @@ Then(/^it should clone "([^"]*)"$/) do |repo|
step %("git clone #{repo}" should be run)
end
Then(/^it should not clone anything$/) do
history.each { |h| expect(h).to_not match(/^git clone/) }
end
Then(/^"([^"]+)" should not be run$/) do |pattern|
history.all? {|h| expect(h).to_not include(pattern) }
history.each { |h| expect(h).to_not include(pattern) }
end
Then(/^there should be no output$/) do
......
......@@ -294,7 +294,7 @@ module Hub
name, owner = arg, nil
owner, name = name.split('/', 2) if name.index('/')
project = github_project(name, owner || github_user)
unless ssh || args[0] == 'submodule' || args.noop? || https_protocol?
unless ssh || args[0] == 'submodule' || https_protocol?
repo_info = api_client.repo_info(project)
ssh = repo_info.success? && (repo_info.data['private'] || repo_info.data['permissions']['push'])
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册