mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 19:11:25 +01:00
fix(label): refuse duplicate label names unless --force
tea label create --name bug twice created a second "bug" label, after which issue edit --add-labels bug failed as ambiguous and issue list --label bug matched nothing. label create (and --file imports) now fail with "label "bug" already exists in alice/project; pass --force to update it", ignoring case; --force updates the existing label. The ambiguity error for labels that already share a name lists their IDs. Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
5 files changed
+92
-10
No files matched your search
@@ -66,7 +66,7 @@ func TestIssueLabelsCombineScopesWithoutSilentlyChoosingDuplicates(t *testing.T)
|
||||
}))
|
||||
service := Labels{Client: client, Repository: "company/project"}
|
||||
_, err := service.ResolveIssueNames(context.Background(), []string{"bug"})
|
||||
require.ErrorContains(t, err, "ambiguous")
|
||||
require.EqualError(t, err, `label "bug" is ambiguous in company/project (IDs 1, 2); pass an ID`)
|
||||
ids, err := service.ResolveIssueNames(context.Background(), []string{"org:bug", "repo:bug", "shared", "shared"})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, []int64{2, 1, 3}, ids)
|
||||
|
||||
Reference in new issue
Block a user