Skip to content

Show rebase pre-receive error to user

Stan Hu requested to merge sh-show-rebase-pre-receive-error into master

What does this MR do and why?

If a project has a push rule configured, a rebase may fail quietly with the message, "Rebase failed. Please rebase locally. Please try again." The user has no idea why this rebase failed.

Since pre-receive messages are sanitized to show only text that starts with "GitLab:", we can safely display these to the user in RebaseService, just as we do in MergeService.

Relates to #213608 (closed)

Screenshots or screen recordings

It seems like we have extraneous error messages popping up below: one flash message at the top, a flash message in the widget, and a rebasingError below the widget.

We seem to create a flash message in https://gitlab.com/gitlab-org/gitlab/blob/809b12710d0e65671cddfc8a6c8a88fe5d48c30f/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue#L124-126 even though we also display rebasingError in https://gitlab.com/gitlab-org/gitlab/blob/809b12710d0e65671cddfc8a6c8a88fe5d48c30f/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue#L190. Maybe we can drop rebasingError since it seems redundant?

I'm also inclined to drop the top flash message when merge_error is present.

Initial failure

image

After reload

image

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. In a project, enable fast-forward merges in the Settings -> General.
  2. Create a new file a.txt and a merge request for that.
  3. Create a new file b.txt and a merge request for that.
  4. Merge one of the merge requests.
  5. Visit the other merge request and click Rebase.

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 Stan Hu

Merge request reports