repo fork: simplify printing the name of an existing forked repo
This commit is contained in:
parent
bc3f964621
commit
a6335396cf
2 changed files with 2 additions and 11 deletions
|
|
@ -301,14 +301,6 @@ func repoFork(cmd *cobra.Command, args []string) error {
|
|||
s.FinalMSG = utils.Gray(fmt.Sprintf("- %s\n", loading))
|
||||
s.Start()
|
||||
|
||||
authLogin, err := ctx.AuthLogin()
|
||||
if err != nil {
|
||||
s.Stop()
|
||||
return fmt.Errorf("could not determine current username: %w", err)
|
||||
}
|
||||
|
||||
possibleFork := ghrepo.New(authLogin, toFork.RepoName())
|
||||
|
||||
forkedRepo, err := api.ForkRepo(apiClient, toFork)
|
||||
if err != nil {
|
||||
s.Stop()
|
||||
|
|
@ -325,7 +317,7 @@ func repoFork(cmd *cobra.Command, args []string) error {
|
|||
if created_ago > time.Minute {
|
||||
fmt.Fprintf(out, "%s %s %s\n",
|
||||
utils.Yellow("!"),
|
||||
utils.Bold(ghrepo.FullName(possibleFork)),
|
||||
utils.Bold(ghrepo.FullName(forkedRepo)),
|
||||
"already exists")
|
||||
} else {
|
||||
fmt.Fprintf(out, "%s Created fork %s\n", greenCheck, utils.Bold(ghrepo.FullName(forkedRepo)))
|
||||
|
|
|
|||
|
|
@ -18,9 +18,8 @@ import (
|
|||
func TestRepoFork_already_forked(t *testing.T) {
|
||||
initContext = func() context.Context {
|
||||
ctx := context.NewBlank()
|
||||
ctx.SetBaseRepo("REPO")
|
||||
ctx.SetBaseRepo("OWNER/REPO")
|
||||
ctx.SetBranch("master")
|
||||
ctx.SetAuthLogin("someone")
|
||||
ctx.SetRemotes(map[string]string{
|
||||
"origin": "OWNER/REPO",
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue