Issue in merge request gitlab-ce

Hello,

let me brief you about what we are trying to achieve that we have created a custom server-side update hook(in the path /var/opt/gitlab/git-data/repositories/root//custom_hooks) written in Bash script to enforce the developers to follow certain conditions/policies in the commit they push .Now , the problem we are facing is that we are unable to merge the commit to master from any source branch after developer pushes the commit to the source branch. When we click on merge it says something went wrong in pre-receive merge hook ,refresh happens automatically for around 10 secs and again same error when we click on merge every time.

So I would request you please have a look into it and let us know what we could do to resolve this.
my sample script is as follows:
#! /bin/bash
echo “Checking whether git commit has following release pattern or not !!”
ref_name=$1
ref=3 msg=(git log --pretty=%B -n 1 $ref | sed 'd') result=(git log --pretty=%B -n 1 $ref | sed ‘$d’ | grep releaseTag=v.*)
echo “New ref received, ref is: $ref to ref name: $ref_name and commit msg is: msg" if [[ -z "{result}” ]]
then
echo “######## Requested git commit msg didn’t follow the pattern, hence rejecting, follow this pattern releaseTag=v1.11 #########”
exit 1
fi
echo “######## Commit msg followed the pattern, hence accepting ########”

Images are uploaded.

Regards,
Veeresha R