зеркало из https://github.com/mislav/hub.git
Fix cuke for forking private repo
This commit is contained in:
Родитель
0dc6b9f6ba
Коммит
78389b5250
|
@ -69,7 +69,8 @@ func fork(cmd *Command, args *Args) {
|
|||
if flagForkNoRemote {
|
||||
os.Exit(0)
|
||||
} else {
|
||||
originURL := project.GitURL("", "", false)
|
||||
originRemote, _ := localRepo.OriginRemote()
|
||||
originURL := originRemote.URL.String()
|
||||
url := forkProject.GitURL("", "", true)
|
||||
args.Replace("git", "remote", "add", "-f", forkProject.Owner, originURL)
|
||||
args.After("git", "remote", "set-url", forkProject.Owner, url)
|
||||
|
|
|
@ -22,8 +22,8 @@ Feature: hub fork
|
|||
Given the GitHub API server:
|
||||
"""
|
||||
before { halt 401 unless request.env['HTTP_AUTHORIZATION'] == 'token OTOKEN' }
|
||||
get('/repos/mislav/dotfiles', :host_name => 'api.github.com') { 404 }
|
||||
post('/repos/evilchelu/dotfiles/forks', :host_name => 'api.github.com') { '' }
|
||||
get('/repos/mislav/dotfiles') { 404 }
|
||||
post('/repos/evilchelu/dotfiles/forks') { '' }
|
||||
"""
|
||||
When I successfully run `hub fork`
|
||||
Then the output should contain exactly "new remote: mislav\n"
|
||||
|
|
|
@ -123,10 +123,15 @@ func (r *GitHubRepo) RemoteBranchAndProject(owner string) (branch *Branch, proje
|
|||
return
|
||||
}
|
||||
|
||||
func (r *GitHubRepo) OriginRemote() (*Remote, error) {
|
||||
return r.RemoteByName("origin")
|
||||
}
|
||||
|
||||
func (r *GitHubRepo) MainProject() (project *Project, err error) {
|
||||
origin, err := r.RemoteByName("origin")
|
||||
origin, err := r.OriginRemote()
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Aborted: the origin remote doesn't point to a GitHub repository.")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче