mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 19:11:25 +01:00
fix(issue): reject unknown milestones in issue list and search filters
Gitea drops milestone filter values it cannot resolve and lists every issue when none is left, so tea issue list --milestone nope printed all issues and exited 0, and a pipeline closing the result would act on all of them. issue list and search issue|pr -R now resolve each --milestone value by ID or title and fail with "milestone "nope" not found in alice/project". Instance-wide search cannot check the names and says so on stderr. Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
4 files changed
+125
-12
No files matched your search
@@ -37,6 +37,10 @@ func (a *application) discussionSearchCommand(pulls bool) *cobra.Command {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
milestones, err := nameFilter("milestone", opts.Milestones)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
target, err := a.resolve(cmd.Context(), false)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -50,13 +54,15 @@ func (a *application) discussionSearchCommand(pulls bool) *cobra.Command {
|
||||
if opts.Team != "" && target.Repo != "" {
|
||||
return clierr.Wrap(clierr.Usage, errors.New("--team requires instance-wide search; omit --repo or TEA_REPO"))
|
||||
}
|
||||
if len(labelNames) > 0 {
|
||||
if target.Repo != "" {
|
||||
if err := (services.Labels{Client: target.client, Repository: target.Repo}).RequireFilterNames(cmd.Context(), labelNames); err != nil {
|
||||
return err
|
||||
}
|
||||
if target.Repo != "" {
|
||||
if opts.Labels, opts.Milestones, err = issueFilters(cmd, target, labelNames, milestones); err != nil {
|
||||
return err
|
||||
}
|
||||
} else if len(labelNames)+len(milestones) > 0 {
|
||||
opts.Labels, opts.Milestones = strings.Join(labelNames, ","), strings.Join(milestones, ",")
|
||||
if _, err := fmt.Fprintln(cmd.ErrOrStderr(), "warning: instance-wide search ignores --label and --milestone values that match nothing; pass --repo to check them"); err != nil {
|
||||
return err
|
||||
}
|
||||
opts.Labels = strings.Join(labelNames, ",")
|
||||
}
|
||||
opts.Query = strings.Join(args, " ")
|
||||
items, err := (services.Issues{Client: target.client, Repository: target.Repo}).Search(cmd.Context(), opts)
|
||||
|
||||
Reference in new issue
Block a user