Return projects with include_subgroups

Summary

In at least three case (GET /api/v4/groups/:id/projects?include_subgroups=true), some projects are not returned when they should be.

Steps to reproduce

  • Create a hierarchy of subgroups, make API calls retrieving the results
  • Move project in subgroup with depth 2
  • Rename project
  • Again move project

Example Project

hierarchy

-  M (GROUP_ID = 22)
--- D (GROUP_ID = 32)
------ all.git
------ test.git
# Get D (GROUP_ID = 32)
curl https://host/api/v4/groups/32/projects\?include_subgroups\=true | jq '.[].ssh_url_to_repo'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4787  100  4787    0     0  34941      0 --:--:-- --:--:-- --:--:-- 34941
"git@host:m/d/test.git"
"git@host:m/d/all.git"
# Get M (GROUP_ID = 22)
curl https://host/api/v4/groups/22/projects\?include_subgroups\=true | jq '.[].ssh_url_to_repo' | grep "m/d"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48463  100 48463    0     0  86695      0 --:--:-- --:--:-- --:--:-- 86695
"git@host:m/d/test.git"

What is the expected correct behavior?

  • "git@host:m/d/test.git"
  • "git@host:m/d/all.git"

Components

  • GitLab 12.5.4 (63af04cacf5)
  • GitLab Shell 10.2.0
  • GitLab Workhorse v8.14.1
  • GitLab API v4
  • Ruby 2.6.3p62
  • Rails 5.2.3
  • PostgreSQL 10.10