• Kassio Borges's avatar
    BulkImports: avoid infinity recursion on group migration · 0e58741c
    Kassio Borges authored
    The current subgroup migration strategy works iteratively, which means
    that each level of a group tree is imported before moving to the next
    level.
    
    This becomes a problem when the target group is within the source group,
    which creates a _infinity_ loop of import.
    
    >> Example:
    
    Given a group tree like:
    
    - Group A
      - Group B
      - Group C
        - Group X
        - Group Y
    
    If one decide to import the Group A into Group B, a recursion will
    happen, making the import stop only when the depth limit is achieved or
    some other database constraint, like the size of a group path.
    
    - Group A
      - Group B
        - Group A
          - Group B
            - Group A
              - Group B
                - Group A
                  - Group B
                    - ...
                  - Group C
                    - Group X
                    - Group Y
              - Group C
                - Group X
                - Group Y
          - Group C
            - Group X
            - Group Y
      - Group C
        - Group X
        - Group Y
    
    To fix that, destination namespaces cannot be a descendant of the source
    group.
    
    Related to: https://gitlab.com/gitlab-org/gitlab/-/issues/300445
    0e58741c
entity_spec.rb 5.38 KB