Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Issues
  • #4024

Closed
Open
Created May 22, 2013 by Administrator@rootOwner

gitlab 5.1, 5.2 - Merge via GUI passes through bypassing update-hook decline

Created by: vemod

* Created branch
* Commited
* Requested a merge. 
* action: click on accept request. 
* result: no error message. email sent with "merge accepted". branches merged but in the githost.log shows update-hook decline. 
* expected: merge failure due to decline from update-hook.

messages from merging process should be displayed somehow. otherwise not clear whats happening and to be able to see logs have to login with admin panel.

I have customized a little the update hook to execute 2 files instead of default update from gitlab-shell. so my hook basically executes gitlab default hook then php syntax error checker script.

well in anyway hook declines push. so merge should fail and error reported.

my hook:


FILE=`mktemp`
cat - > $FILE
echo
echo "Running GitLabHQ Checks"
if [ -L $0 ]; then
        dir=$(dirname $(readlink -f $0))
else 
        dir=$GIT_DIR/hooks
fi
cat $FILE | $dir/update.gitlab $* || exit 1
echo
echo "Running Syntax Checks"
cat $FILE | $dir/update.syn $* || exit 1
rm $FILE

update.gitlab - is unmodified "update" file from gitlab-shell, update.syn - my hook which checks code for unwanted keywords and syntax. worked fine on 5.1

Output in githost.log

May 21, 2013 19:54 -> ERROR -> Command failed [1]: /usr/bin/git --git-dir=/home/git/gitlab-satellites/someuser/testgitfeatures/.git push origin master

remote:
remote: Running GitLabHQ Checks.
remote:
remote: Running Syntax Checks.
remote:
remote: diff-tree:.
remote: :000000 100644 0000000000000000000000000000000000000000 76261c3bcba4db9fc0bc54532238d9aba86479eb A      newfile1.php.
remote:
remote: Update-Hook Error: .
remote: PHP Parse error:  syntax error, unexpected $end, expecting ',' or ';' in newfile1.php on line 4.
remote: For more details run this:  git diff 0000000000000000000000000000000000000000 76261c3bcba4db9fc0bc54532238d9aba86479eb .
remote:
remote: error: hook declined to update refs/heads/master.
To /var/gitlab/repositories/someuser/testgitfeatures.git
 ! [remote rejected] master -> master (hook declined)
error: failed to push some refs to '/var/gitlab/repositories/someuser/testgitfeatures.git'
Assignee
Assign to
Time tracking