1. 23 Sep, 2019 1 commit
    • Stan Hu's avatar
      Fix bug that caused a merge to show an error message · 55468506
      Stan Hu authored
      When a project approval rule is created that requires N approvers in the
      project (also known as an `any_approver` rule), `MergeService` would
      always fail with a "Name has already been taken" validation error.
      
      This causes `MergeWorker` to run again and show different error messages
      to the user. If squashing were enabled, users would see, "Merge failed:
      Failed to squash. Should be done manually.. Please try again."
      Otherwise, users would see, "Merge failed: Merge request is not
      mergeable". In both cases, the merge was actually successful.
      
      This error occurred because:
      
      1. When a merge request is created, `MergeRequests::CreateService` syncs
      some project approval rules (e.g. report types) to the list of merge
      request approvals.
      
      2. If only the `any_approver` rule is present,
      `ApprovalRules::FinalizeService` will attempt to create a new merge
      request approval rule since
      `merge_request.approval_rules.regular.exists?` is `false`..
      
      To fix this, we don't copy over the merge request rule if one by the
      same name already exists.
      
      Closes https://gitlab.com/gitlab-org/gitlab/issues/32477
      55468506
  2. 22 Sep, 2019 2 commits
  3. 21 Sep, 2019 2 commits
  4. 20 Sep, 2019 35 commits