remote name can be specified in the create command

This commit is contained in:
Paul Gierz 2019-02-09 13:11:53 +01:00
Родитель 08004b9218
Коммит e2be7f1960
2 изменённых файлов: 18 добавлений и 1 удалений

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

@ -128,7 +128,13 @@ func create(command *Command, args *Args) {
localRepo, err := github.LocalRepo()
utils.Check(err)
originName := "origin"
var originName string
if flagOriginRemoteName := args.Flag.Value("--remote-name"); flagOriginRemoteName != "" {
originName = flagOriginRemoteName
} else {
originName = "origin"
}
if originRemote, err := localRepo.RemoteByName(originName); err == nil {
originProject, err := originRemote.Project()
if err != nil || !originProject.SameAs(project) {

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

@ -27,6 +27,17 @@ Feature: hub create
"""
When I successfully run `hub create -p`
Then the url for "origin" should be "git@github.com:mislav/dotfiles.git"
Scenario: Create repo with new remote name specified
Given the GitHub API server:
"""
post('/user/repos') {
assert :private => false
status 201
json :full_name => 'mislav/dotfiles'
}
"""
When I sucessfully run `hub create --remote-name=work`
Then the url for "work" should be "git@github.com:mislav/dotfiles.git"
Scenario: HTTPS is preferred
Given the GitHub API server: