diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-01-29 11:32:05 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-01-29 11:32:05 +0200 |
commit | 7121a58eb9e4dcb63d762e17a668f3bb4b0eaa85 (patch) | |
tree | e62e057429b4f10bba499068e37d2c80baf8a351 /app/workers | |
parent | f72dc7f7798f521d20a71fb465df57f0d66befb5 (diff) | |
download | gitlab-ce-7121a58eb9e4dcb63d762e17a668f3bb4b0eaa85.tar.gz |
Advanced logging for post-receive worker
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/post_receive.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/app/workers/post_receive.rb b/app/workers/post_receive.rb index a906f78f7e3..6d31c08fefc 100644 --- a/app/workers/post_receive.rb +++ b/app/workers/post_receive.rb @@ -4,12 +4,22 @@ class PostReceive sidekiq_options queue: :post_receive def perform(repo_path, oldrev, newrev, ref, identifier) - repo_path.gsub!(Gitlab.config.gitolite.repos_path.to_s, "") + + if repo_path.start_with?(Gitlab.config.gitolite.repos_path.to_s) + repo_path.gsub!(Gitlab.config.gitolite.repos_path.to_s, "") + else + Gitlab::GitLogger.error("POST-RECEIVE: Check gitlab.yml config for correct gitolite.repos_path variable. \"#{Gitlab.config.gitolite.repos_path}\" does not match \"#{repo_path}\"") + end + repo_path.gsub!(/.git$/, "") repo_path.gsub!(/^\//, "") project = Project.find_with_namespace(repo_path) - return false if project.nil? + + if project.nil? + Gitlab::GitLogger.error("POST-RECEIVE: Triggered hook for non-existing project with full path \"#{repo_path} \"") + return false + end # Ignore push from non-gitlab users user = if identifier.eql? Gitlab.config.gitolite.admin_key |