repo fork: check that --org is not the empty string
As it is already being done for --remote-name, except in this case the default is the empty string.
This commit is contained in:
parent
aecfc01e69
commit
54b86c7093
2 changed files with 10 additions and 0 deletions
|
|
@ -83,6 +83,10 @@ Additional 'git clone' flags can be passed in by listing them after '--'.`,
|
|||
opts.GitArgs = args[1:]
|
||||
}
|
||||
|
||||
if cmd.Flags().Changed("org") && opts.Organization == "" {
|
||||
return &cmdutil.FlagError{Err: errors.New("--org cannot be blank")}
|
||||
}
|
||||
|
||||
if opts.RemoteName == "" {
|
||||
return &cmdutil.FlagError{Err: errors.New("--remote-name cannot be blank")}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,6 +120,12 @@ func TestNewCmdFork(t *testing.T) {
|
|||
Organization: "batmanshome",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "empty org",
|
||||
cli: " --org=''",
|
||||
wantErr: true,
|
||||
errMsg: "--org cannot be blank",
|
||||
},
|
||||
{
|
||||
name: "git flags in wrong place",
|
||||
cli: "--depth 1 OWNER/REPO",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue