Test the `in_progress_merge_commit_sha` flag
Context
- A user has merge access to a protected branch, and not push access
- The user tries to merge an open merge request into the protected branch
- The
in_progress_merge_commit_sha
flag is set to the prospective merge commit's SHA -
gitlab-shell
calls thepre-receive
hook before performing the merge - The hook runs the branch permissions validations, and finds that the current merge matches an open merge request, using the
in_progress_merge_commit_sha
, and passes
Current Tests
- Branch permission enforcement is tested in
GitAccessSpec
- A merge commit is manually created with the
in_progress_merge_commit_sha
flag set - The test directly calls (a portion of) the
pre-receive
hook
Problem
- The
in_progress_merge_commit_sha
flag wasn't set for fast-forward merges (gitlab-org/gitlab-ee#900).
Requirement
- Tests for
Repository#ff_merge
are being added in gitlab-org/gitlab-ee!671. - We need a similar test for
Repository#merge