summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2014-07-27 22:26:23 +0200
committerRobert Schilling <rschilling@student.tugraz.at>2014-07-27 23:48:53 +0200
commit062ff17b1cd65485d88b676584ae793cce8b3345 (patch)
tree46a8712190b95113d4b277053b0950a03270ffc0 /app/controllers
parentcb0d63b9e3fa464ae8c0cd9cf7bdb8d080a7e02f (diff)
downloadgitlab-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.rb7
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