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
  • #9111

Closed
Open
Created Apr 09, 2015 by Administrator@rootOwner

Improve user feedback in UI when update hook declines a push

Created by: artlepool

GitLab v7.9.1 GitLab Shell 2.6.0 GitLab API v3

Hi I have added an update hook into my repo via the file system (custom_hooks/update). It checks to see if you have included the string "[ref: 1234]" in the commit message. If you haven't, it returns 1 and therefore declines the commit, returning a message to the committer about why its been declined - "[POLICY] Your message is not formatted correctly"

When using the command-line to commit and push with a commit message that is unsuitable, the hook declines the commit and the decline reason message is shown to the user so all works well as expected.

If you edit a file in the UI and save it there, the push is still declined as you would hope, but the message shown to the user is far from clear and is very generic, ie a red bar at the top of the page saying "Your changes could not be committed. Maybe the file was changed by another process?"

The githost.log file on the server records the behind-the-scenes output of attempting to push via the UI:

April 09, 2015 20:58 -> ERROR -> Command failed [1]: /usr/local/bin/git --git-dir=/home/git/gitlab-satellites/ChrisWilson/my-project/.git --work-tree=/home/git/gitlab-satellites/ChrisWilson/my-project push origin master:master

remote: Checking commit message
remote: [POLICY] Your message is not formatted correctly
remote: error: hook declined to update refs/heads/master
To /home/git/repositories/ChrisWilson/my-project.git
 ! [remote rejected] master -> master (hook declined)
error: failed to push some refs to '/home/git/repositories/ChrisWilson/my-project.git'

Is there any way the error message to the user could be improved in the UI to alert them as to the fact that, in this case, the hook has declined the commit, and the reason for it?

thanks! Chris

Assignee
Assign to
Time tracking