Merge pull request #12375 from majiayu000/2722-fix-fork-remote-flag
fix: error when --remote flag used with repo argument
This commit is contained in:
commit
628dea6e52
2 changed files with 10 additions and 0 deletions
|
|
@ -113,6 +113,10 @@ func NewCmdFork(f *cmdutil.Factory, runF func(*ForkOptions) error) *cobra.Comman
|
|||
opts.Rename = true // Any existing 'origin' will be renamed to upstream
|
||||
}
|
||||
|
||||
if opts.Repository != "" && cmd.Flags().Changed("remote") {
|
||||
return cmdutil.FlagErrorf("the `--remote` flag is unsupported when a repository argument is provided")
|
||||
}
|
||||
|
||||
if promptOk {
|
||||
// We can prompt for these if they were not specified.
|
||||
opts.PromptClone = !cmd.Flags().Changed("clone")
|
||||
|
|
|
|||
|
|
@ -144,6 +144,12 @@ func TestNewCmdFork(t *testing.T) {
|
|||
Rename: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "remote with repo argument",
|
||||
cli: "foo/bar --remote",
|
||||
wantErr: true,
|
||||
errMsg: "the `--remote` flag is unsupported when a repository argument is provided",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue