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

Merge branch 'remote_names'

Fixes https://github.com/github/hub/issues/2025
......@@ -26,6 +26,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.
......@@ -125,7 +128,11 @@ func create(command *Command, args *Args) {
localRepo, err := github.LocalRepo()
utils.Check(err)
originName := "origin"
originName := args.Flag.Value("--remote-name")
if originName == "" {
originName = "origin"
}
if originRemote, err := localRepo.RemoteByName(originName); err == nil {
originProject, err := originRemote.Project()
if err != nil || !originProject.SameAs(project) {
......
......@@ -28,6 +28,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: Alternate origin remote name
Given the GitHub API server:
"""
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.
先完成此消息的编辑!
想要评论请 注册