diff options
author | Robert Schilling <rschilling@student.tugraz.at> | 2014-07-27 22:26:23 +0200 |
---|---|---|
committer | Robert Schilling <rschilling@student.tugraz.at> | 2014-07-27 23:48:53 +0200 |
commit | 062ff17b1cd65485d88b676584ae793cce8b3345 (patch) | |
tree | 46a8712190b95113d4b277053b0950a03270ffc0 /app/controllers | |
parent | cb0d63b9e3fa464ae8c0cd9cf7bdb8d080a7e02f (diff) | |
download | gitlab-ce-062ff17b1cd65485d88b676584ae793cce8b3345.tar.gz |
Do not execute hooks on empty projects, fixes #6108
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/hooks_controller.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/projects/hooks_controller.rb b/app/controllers/projects/hooks_controller.rb index 268e19f26ee..c8269ed99ce 100644 --- a/app/controllers/projects/hooks_controller.rb +++ b/app/controllers/projects/hooks_controller.rb @@ -24,7 +24,12 @@ class Projects::HooksController < Projects::ApplicationController end def test - TestHookService.new.execute(hook, current_user) + if !@project.empty_repo? + TestHookService.new.execute(hook, current_user) + flash[:notice] = 'Hook successfully executed.' + else + flash[:alert] = 'Hook execution failed. Ensure the project has commits.' + end redirect_to :back end |