Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-shell
Commits
ac8bbb95
Commit
ac8bbb95
authored
Nov 29, 2017
by
Mayra Cabrera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prints a message if project was redirected
parent
76e75549
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletion
+36
-1
lib/gitlab_post_receive.rb
lib/gitlab_post_receive.rb
+1
-1
spec/gitlab_post_receive_spec.rb
spec/gitlab_post_receive_spec.rb
+35
-0
No files found.
lib/gitlab_post_receive.rb
View file @
ac8bbb95
...
...
@@ -25,9 +25,9 @@ class GitlabPostReceive
end
return
false
unless
response
print_broadcast_message
(
response
[
'broadcast_message'
])
if
response
[
'broadcast_message'
]
print_merge_request_links
(
response
[
'merge_request_urls'
])
if
response
[
'merge_request_urls'
]
puts
response
[
'redirected_message'
]
if
response
[
'redirected_message'
]
response
[
'reference_counter_decreased'
]
rescue
GitlabNet
::
ApiUnreachableError
...
...
spec/gitlab_post_receive_spec.rb
View file @
ac8bbb95
...
...
@@ -206,6 +206,30 @@ describe GitlabPostReceive do
expect
(
gitlab_post_receive
.
exec
).
to
eq
(
true
)
end
end
context
'when redirected message available'
do
let
(
:message
)
do
<<-
MSG
Project 'foo/bar' was moved to 'foo/baz'.
Please update your Git remote:
git remote set-url origin http://localhost:3000/foo/baz.git
MSG
end
let
(
:response
)
do
{
'reference_counter_decreased'
=>
true
,
'redirected_message'
=>
message
}
end
it
'prints redirected message'
do
expect_any_instance_of
(
GitlabNet
).
to
receive
(
:post_receive
).
and_return
(
response
)
assert_redirected_message_printed
(
gitlab_post_receive
)
expect
(
gitlab_post_receive
.
exec
).
to
eq
(
true
)
end
end
end
end
...
...
@@ -252,4 +276,15 @@ describe GitlabPostReceive do
"========================================================================"
).
ordered
end
def
assert_redirected_message_printed
(
gitlab_post_receive
)
message
=
<<-
MSG
Project 'foo/bar' was moved to 'foo/baz'.
Please update your Git remote:
git remote set-url origin http://localhost:3000/foo/baz.git
MSG
expect
(
gitlab_post_receive
).
to
receive
(
:puts
).
with
(
message
).
ordered
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment