Skip to content

Unify response from UI and API for rebase operation

Vasilii Iakliushin requested to merge 386537_unify_rebase_response into master

What does this MR do and why?

Contributes #386537 (closed)

Problem

  1. The rebase validation logic is duplicated in two places
  2. Rebase action in controller returns a html 404 page, instead of a json response with an error.

Solution

  • Move shared logic into MergeRequests::RebaseService.
  • Change the rebase response in controller to return json error.

Screenshots or screen recordings

Rebase button on the merge request page

Before fix After fix
Screenshot_2022-12-27_at_12.00.29 Screenshot_2022-12-27_at_11.54.56

How to set up and validate locally

  1. Go to Project Settings -> Merge requests and set Fast-forward merge option.
  2. Create a merge request that is behind of the default branch
  3. Make merge request source branch protected with force push restriction
  4. Press Rebase button on the merge request page
  5. See an error

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Vasilii Iakliushin

Merge request reports