Commit 2550c1c2 authored by Stan Hu's avatar Stan Hu

Merge branch '19842-cloning-a-gitlab-wiki-returns-the-repo-not-the-repo-s-wiki' into 'master'

Fix a bug where the project's repository path was returned instead of the wiki path

Closes #19842 

See merge request !5292
parents 9b597fb5 e94d3834
...@@ -63,7 +63,12 @@ module API ...@@ -63,7 +63,12 @@ module API
if access_status.status if access_status.status
# Return the repository full path so that gitlab-shell has it when # Return the repository full path so that gitlab-shell has it when
# handling ssh commands # handling ssh commands
response[:repository_path] = project.repository.path_to_repo response[:repository_path] =
if wiki?
project.wiki.repository.path_to_repo
else
project.repository.path_to_repo
end
end end
response response
......
...@@ -56,13 +56,21 @@ describe API::API, api: true do ...@@ -56,13 +56,21 @@ describe API::API, api: true do
context "git push with project.wiki" do context "git push with project.wiki" do
it 'responds with success' do it 'responds with success' do
project_wiki = create(:project, name: 'my.wiki', path: 'my.wiki') push(key, project.wiki)
project_wiki.team << [user, :developer]
push(key, project_wiki) expect(response).to have_http_status(200)
expect(json_response["status"]).to be_truthy
expect(json_response["repository_path"]).to eq(project.wiki.repository.path_to_repo)
end
end
context "git pull with project.wiki" do
it 'responds with success' do
pull(key, project.wiki)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
expect(json_response["status"]).to be_truthy expect(json_response["status"]).to be_truthy
expect(json_response["repository_path"]).to eq(project.wiki.repository.path_to_repo)
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment