same logic when clone --noop private repos. Fixes #593

This commit is contained in:
Leonardo Pistone 2014-07-15 16:55:24 +02:00
Родитель 9016a39022
Коммит b14337569c
2 изменённых файлов: 13 добавлений и 1 удалений

Просмотреть файл

@ -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 "git clone" should not be run
Scenario: Clone my Enterprise repo
Given I am "mifi" on git.my.org with OAuth token "FITOKEN"
And $GITHUB_HOST is "git.my.org"

Просмотреть файл

@ -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