summaryrefslogtreecommitdiff
path: root/lib/api/internal.rb
diff options
context:
space:
mode:
authorMayra Cabrera <mcabrera@gitlab.com>2017-12-08 17:42:43 +0000
committerDouwe Maan <douwe@gitlab.com>2017-12-08 17:42:43 +0000
commit562fb460b83502c060cd84b1627dc33098e01c31 (patch)
tree36d354ef789c26146f29a00400c240b76f5c02ca /lib/api/internal.rb
parent8730054683c00f4c79cf452beef0df794c70bf6b (diff)
downloadgitlab-ce-562fb460b83502c060cd84b1627dc33098e01c31.tar.gz
Allow git pull/push on project redirects
Diffstat (limited to 'lib/api/internal.rb')
-rw-r--r--lib/api/internal.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/api/internal.rb b/lib/api/internal.rb
index 451121a4cea..ccaaeca10d4 100644
--- a/lib/api/internal.rb
+++ b/lib/api/internal.rb
@@ -4,6 +4,7 @@ module API
before { authenticate_by_gitlab_shell_token! }
helpers ::API::Helpers::InternalHelpers
+ helpers ::Gitlab::Identifier
namespace 'internal' do
# Check if git command is allowed to project
@@ -176,17 +177,25 @@ module API
post '/post_receive' do
status 200
-
PostReceive.perform_async(params[:gl_repository], params[:identifier],
params[:changes])
broadcast_message = BroadcastMessage.current&.last&.message
reference_counter_decreased = Gitlab::ReferenceCounter.new(params[:gl_repository]).decrease
- {
+ output = {
merge_request_urls: merge_request_urls,
broadcast_message: broadcast_message,
reference_counter_decreased: reference_counter_decreased
}
+
+ project = Gitlab::GlRepository.parse(params[:gl_repository]).first
+ user = identify(params[:identifier])
+ redirect_message = Gitlab::Checks::ProjectMoved.fetch_redirect_message(user.id, project.id)
+ if redirect_message
+ output[:redirected_message] = redirect_message
+ end
+
+ output
end
end
end