Group labels are duplicated on move to subgroup
Summary
When moving a project to a subgroup within the same ancestor group, assigned group-level labels become project-level labels. Since gitlab-ce#40915, it is possible to assign labels from any ancestor group within a subgroup, so the group label could just continue to be used. In fact, it appears to still be assigned in addition to the new project-level label (see also gitlab-ce#45413).
Steps to reproduce
Have a top-level group "G" with a subgroup "S", a group label "L" and a project "P". Within "P", have an issue "I". When moving "P" to "S", "L" gets duplicated to a project label for "P".
Example Project
Take a look at the "F30 Subgroup Bug Demo" group. "Moved Project" originally resided directly in the top-level group.
After creating "Demo Label Issue" and moving the project, "demo-label" is now a project label for "Moved Project". However, the issue also still shows up for the "demo-label" project label.
What is the current bug behavior?
The label gets duplicated on move.
What is the expected correct behavior?
There should be a check to see whether the move happens within the same ancestor group, and the label can therefore continue to be used. In such cases, it should not get duplicated.
GitLab environment info
Reproduced on GitLab.com as well as on a self-hosted GitLab CE 10.7.3 instance.