Merge pull request #9983 from timrogers/timrogers/fork-rename
When renaming an existing remote as part of remote creation in `gh repo fork`, log the change
This commit is contained in:
commit
5a74934d19
2 changed files with 6 additions and 2 deletions
|
|
@ -306,6 +306,10 @@ func forkRun(opts *ForkOptions) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if connectedToTerminal {
|
||||
fmt.Fprintf(stderr, "%s Renamed remote %s to %s\n", cs.SuccessIcon(), cs.Bold(remoteName), cs.Bold(renameTarget))
|
||||
}
|
||||
} else {
|
||||
return fmt.Errorf("a git remote named '%s' already exists", remoteName)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ func TestRepoFork(t *testing.T) {
|
|||
return true, nil
|
||||
})
|
||||
},
|
||||
wantErrOut: "✓ Created fork someone/REPO\n✓ Added remote origin\n",
|
||||
wantErrOut: "✓ Created fork someone/REPO\n✓ Renamed remote origin to upstream\n✓ Added remote origin\n",
|
||||
},
|
||||
{
|
||||
name: "implicit tty reuse existing remote",
|
||||
|
|
@ -370,7 +370,7 @@ func TestRepoFork(t *testing.T) {
|
|||
cs.Register("git remote rename origin upstream", 0, "")
|
||||
cs.Register(`git remote add origin https://github.com/someone/REPO.git`, 0, "")
|
||||
},
|
||||
wantErrOut: "✓ Created fork someone/REPO\n✓ Added remote origin\n",
|
||||
wantErrOut: "✓ Created fork someone/REPO\n✓ Renamed remote origin to upstream\n✓ Added remote origin\n",
|
||||
},
|
||||
{
|
||||
name: "implicit nontty reuse existing remote",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue