Merge pull request #13097 from Bahtya/fix-limit-final

Fix infinite loop in `gh release list --limit 0`
This commit is contained in:
Babak K. Shandiz 2026-04-04 11:30:21 +01:00 committed by GitHub
commit d0558fcbaa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View file

@ -44,6 +44,10 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
// support `-R, --repo` override
opts.BaseRepo = f.BaseRepo
if opts.LimitResults < 1 {
return cmdutil.FlagErrorf("invalid limit: %v", opts.LimitResults)
}
if runF != nil {
return runF(opts)
}

View file

@ -58,6 +58,11 @@ func Test_NewCmdList(t *testing.T) {
Order: "desc",
},
},
{
name: "zero limit",
args: "--limit 0",
wantErr: "invalid limit: 0",
},
{
name: "with order",
args: "--order asc",