Creation of subgroups with the same name, but different path throws 500

Summary

When trying to create Subgroup with the same name, but different path, GitLab returns Error 500.

You can create 'root' groups with the same name, but different path. Both https://gitlab.com/group-master and https://gitlab.com/group-master1 have the same name.

But if I try to create another Subgroup with name 'some slave' and path 'group-master/some-slave1', it ends with Error 500.

Steps to reproduce

  1. Create group (the path does not matter)
  2. In the group created in step 1 create subgroup with name 'Child' and path 'child'
  3. In the group created in step 1 create subgroup with name 'Child' and path 'child1'

Example Project

N/A

What is the current bug behavior?

500 Internal Server Error

What is the expected correct behavior?

A user-friendly error is returned.

Relevant logs and/or screenshots

N/A

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Edited by Liam McAndrew