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

[create] Support `--remote-name <REMOTE>` argument

上级 e2be7f19
......@@ -27,6 +27,9 @@ var cmdCreate = &Command{
A URL with more information about the repository. Use this, for example, if
your project has an external website.
--remote-name <REMOTE>
Set the name for the new git remote (default: "origin").
-o, --browse
Open the new repository in a web browser.
......@@ -128,12 +131,10 @@ func create(command *Command, args *Args) {
localRepo, err := github.LocalRepo()
utils.Check(err)
var originName string
if flagOriginRemoteName := args.Flag.Value("--remote-name"); flagOriginRemoteName != "" {
originName = flagOriginRemoteName
} else {
originName = "origin"
}
originName := args.Flag.Value("--remote-name")
if originName == "" {
originName = "origin"
}
if originRemote, err := localRepo.RemoteByName(originName); err == nil {
originProject, err := originRemote.Project()
......
......@@ -27,17 +27,18 @@ 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
Scenario: Alternate origin remote name
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`
"""
post('/user/repos') {
status 201
json :full_name => 'mislav/dotfiles'
}
"""
When I successfully run `hub create --remote-name=work`
Then the url for "work" should be "git@github.com:mislav/dotfiles.git"
And there should be no "origin" remote
Scenario: HTTPS is preferred
Given the GitHub API server:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册