Handle custom Git hook result in GitLab UI
The GitLab merge request UI should handle the returned result from a custom Git hook when a MR merge is attempted.
- Configure a custom project Git hook
This will reject any push to master which has any non-linear history
oldrev="$2" newrev="$3" merge_commit=$(git rev-list -n 1 --merges $oldrev..$newrev) if [ -n "$merge_commit" ]; then echo "Merge commit detected: $merge_commit"; exit 1 fi
- Create a new merge request that will be rejected due to non-linear history (contains a merge from another branch)
- Accept this merge request via the GitLab UI
- "Something went wrong during merge" is displayed when accepting the MR.
- Output of why the merge failed. eg. "Failed due to pre-receive hook" include hook output?