summaryrefslogtreecommitdiff
path: root/lib/api/helpers
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-02-07 09:21:17 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-02-07 09:21:17 +0100
commit2cce501f452e84d9fe8c27bd0291e4984c12bc4c (patch)
tree5b98215be26330c0db4b39e2f5f39720f0c63f2c /lib/api/helpers
parentadb6dd067037a3df1951b5dacae37a06541ec286 (diff)
parent4457cf9d178dc9912fd9c16427ad81b389179d00 (diff)
downloadgitlab-ce-2cce501f452e84d9fe8c27bd0291e4984c12bc4c.tar.gz
Merge commit '4457cf9d178dc9912fd9c16427ad81b389179d00' into fix/gb/fix-redundant-pipeline-stagesfix/gb/fix-redundant-pipeline-stages
* commit '4457cf9d178dc9912fd9c16427ad81b389179d00': (76 commits) Conflicts: spec/services/ci/retry_build_service_spec.rb
Diffstat (limited to 'lib/api/helpers')
-rw-r--r--lib/api/helpers/internal_helpers.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/api/helpers/internal_helpers.rb b/lib/api/helpers/internal_helpers.rb
index eb67de81a0d..cd59da6fc70 100644
--- a/lib/api/helpers/internal_helpers.rb
+++ b/lib/api/helpers/internal_helpers.rb
@@ -60,8 +60,20 @@ module API
false
end
+ def project_path
+ project&.path || project_path_match[:project_path]
+ end
+
+ def namespace_path
+ project&.namespace&.full_path || project_path_match[:namespace_path]
+ end
+
private
+ def project_path_match
+ @project_path_match ||= params[:project].match(Gitlab::PathRegex.full_project_git_path_regex) || {}
+ end
+
# rubocop:disable Gitlab/ModuleWithInstanceVariables
def set_project
if params[:gl_repository]