Merge branch 'trunk' into 10348-escape-pipe-in-long-description-for-website-manual
This commit is contained in:
commit
139271d85c
5 changed files with 41 additions and 2 deletions
9
acceptance/testdata/repo/repo-rename-transfer-ownership.txtar
vendored
Normal file
9
acceptance/testdata/repo/repo-rename-transfer-ownership.txtar
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# Create a repository with a file so it has a default branch
|
||||
exec gh repo create $ORG/$SCRIPT_NAME-$RANDOM_STRING --add-readme --private
|
||||
|
||||
# Attempt to rename the repo with a slash in the name
|
||||
! exec gh repo rename $ORG/new-name --repo=$ORG/$SCRIPT_NAME-$RANDOM_STRING --yes
|
||||
stderr 'New repository name cannot contain '/' character - to transfer a repository to a new owner, you must follow additional steps on GitHub.com. For more information on transferring repository ownership, see <https://docs.github.com/en/repositories/creating-and-managing-repositories/transferring-a-repository>.'
|
||||
|
||||
# Defer repo deletion
|
||||
defer gh repo delete $ORG/$SCRIPT_NAME-$RANDOM_STRING --yes
|
||||
|
|
@ -298,9 +298,18 @@ func NewCmdExtension(f *cmdutil.Factory) *cobra.Command {
|
|||
Long: heredoc.Docf(`
|
||||
Install a GitHub CLI extension from a GitHub or local repository.
|
||||
|
||||
For GitHub repositories, the repository argument can be specified in %[1]sOWNER/REPO%[1]s format or as a full repository URL.
|
||||
For GitHub repositories, the repository argument can be specified in
|
||||
%[1]sOWNER/REPO%[1]s format or as a full repository URL.
|
||||
The URL format is useful when the repository is not hosted on github.com.
|
||||
|
||||
For remote repositories, the GitHub CLI first looks for the release artifacts assuming
|
||||
that it's a binary extension i.e. prebuilt binaries provided as part of the release.
|
||||
In the absence of a release, the repository itself is cloned assuming that it's a
|
||||
script extension i.e. prebuilt executable or script exists on its root.
|
||||
|
||||
The %[1]s--pin%[1]s flag may be used to specify a tag or commit for binary and script
|
||||
extensions respectively, the latest version is used otherwise.
|
||||
|
||||
For local repositories, often used while developing extensions, use %[1]s.%[1]s as the
|
||||
value of the repository argument. Note the following:
|
||||
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ func (m *Manager) Install(repo ghrepo.Interface, target string) error {
|
|||
return err
|
||||
}
|
||||
if !hs {
|
||||
return errors.New("extension is not installable: missing executable")
|
||||
return fmt.Errorf("extension is not installable: no usable release artifact or script found in %s", repo)
|
||||
}
|
||||
|
||||
return m.installGit(repo, target)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/MakeNowJust/heredoc"
|
||||
"github.com/cli/cli/v2/api"
|
||||
|
|
@ -124,6 +125,10 @@ func renameRun(opts *RenameOptions) error {
|
|||
}
|
||||
}
|
||||
|
||||
if strings.Contains(newRepoName, "/") {
|
||||
return fmt.Errorf("New repository name cannot contain '/' character - to transfer a repository to a new owner, you must follow additional steps on GitHub.com. For more information on transferring repository ownership, see <https://docs.github.com/en/repositories/creating-and-managing-repositories/transferring-a-repository>.")
|
||||
}
|
||||
|
||||
if opts.DoConfirm {
|
||||
var confirmed bool
|
||||
if confirmed, err = opts.Prompter.Confirm(fmt.Sprintf(
|
||||
|
|
|
|||
|
|
@ -113,6 +113,8 @@ func TestRenameRun(t *testing.T) {
|
|||
promptStubs func(*prompter.MockPrompter)
|
||||
wantOut string
|
||||
tty bool
|
||||
wantErr bool
|
||||
errMsg string
|
||||
}{
|
||||
{
|
||||
name: "none argument",
|
||||
|
|
@ -217,6 +219,16 @@ func TestRenameRun(t *testing.T) {
|
|||
},
|
||||
wantOut: "",
|
||||
},
|
||||
|
||||
{
|
||||
name: "error on name with slash",
|
||||
tty: true,
|
||||
opts: RenameOptions{
|
||||
newRepoSelector: "org/new-name",
|
||||
},
|
||||
wantErr: true,
|
||||
errMsg: "New repository name cannot contain '/' character - to transfer a repository to a new owner, you must follow additional steps on GitHub.com. For more information on transferring repository ownership, see <https://docs.github.com/en/repositories/creating-and-managing-repositories/transferring-a-repository>.",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range testCases {
|
||||
|
|
@ -268,6 +280,10 @@ func TestRenameRun(t *testing.T) {
|
|||
t.Run(tt.name, func(t *testing.T) {
|
||||
defer reg.Verify(t)
|
||||
err := renameRun(&tt.opts)
|
||||
if tt.wantErr {
|
||||
assert.EqualError(t, err, tt.errMsg)
|
||||
return
|
||||
}
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, tt.wantOut, stdout.String())
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue