diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-01-19 13:04:14 +0000 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-02-06 13:35:35 +0000 |
commit | 32b2ff26011a5274bdb8a3dd41ad360a67c3148a (patch) | |
tree | 56064e3de4e9ca505730bdf1af3597ba8ead499f /lib/api/helpers/internal_helpers.rb | |
parent | 35882e681b681f68a818bda9a8d2624edfecc219 (diff) | |
download | gitlab-ce-32b2ff26011a5274bdb8a3dd41ad360a67c3148a.tar.gz |
Adds remote messsage when project is created in a push over SSH or HTTP
Diffstat (limited to 'lib/api/helpers/internal_helpers.rb')
-rw-r--r-- | lib/api/helpers/internal_helpers.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/api/helpers/internal_helpers.rb b/lib/api/helpers/internal_helpers.rb index eb67de81a0d..c0fcae43638 100644 --- a/lib/api/helpers/internal_helpers.rb +++ b/lib/api/helpers/internal_helpers.rb @@ -29,6 +29,10 @@ module API {} end + def receive_pack? + params[:action] == 'git-receive-pack' + end + def fix_git_env_repository_paths(env, repository_path) if obj_dir_relative = env['GIT_OBJECT_DIRECTORY_RELATIVE'].presence env['GIT_OBJECT_DIRECTORY'] = File.join(repository_path, obj_dir_relative) @@ -62,6 +66,18 @@ module API private + def project_path_regex + @project_regex ||= /\A(?<namespace_id>#{Gitlab::PathRegex.full_namespace_route_regex})\/(?<project_id>#{Gitlab::PathRegex.project_git_route_regex})\z/.freeze + end + + def project_match + @match ||= params[:project].match(project_path_regex).captures + end + + def namespace + @namespace ||= Namespace.find_by_path_or_name(project_match[:namespace_id]) + end + # rubocop:disable Gitlab/ModuleWithInstanceVariables def set_project if params[:gl_repository] |