Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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
1
Merge Requests
1
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-ce
Commits
ea18e1bf
Commit
ea18e1bf
authored
Feb 22, 2018
by
Jacob Vosmaer (GitLab)
Committed by
Robert Speicher
Feb 22, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix repo existence check in GitAccessWiki
parent
a5b7f273
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
7 deletions
+29
-7
lib/gitlab/git_access.rb
lib/gitlab/git_access.rb
+5
-1
lib/gitlab/git_access_wiki.rb
lib/gitlab/git_access_wiki.rb
+6
-0
spec/lib/gitlab/git_access_wiki_spec.rb
spec/lib/gitlab/git_access_wiki_spec.rb
+13
-1
spec/requests/api/internal_spec.rb
spec/requests/api/internal_spec.rb
+1
-1
spec/requests/git_http_spec.rb
spec/requests/git_http_spec.rb
+4
-4
No files found.
lib/gitlab/git_access.rb
View file @
ea18e1bf
...
@@ -198,7 +198,7 @@ module Gitlab
...
@@ -198,7 +198,7 @@ module Gitlab
end
end
def
check_repository_existence!
def
check_repository_existence!
unless
project
.
repository
.
exists?
unless
repository
.
exists?
raise
UnauthorizedError
,
ERROR_MESSAGES
[
:no_repo
]
raise
UnauthorizedError
,
ERROR_MESSAGES
[
:no_repo
]
end
end
end
end
...
@@ -327,5 +327,9 @@ module Gitlab
...
@@ -327,5 +327,9 @@ module Gitlab
def
push_to_read_only_message
def
push_to_read_only_message
ERROR_MESSAGES
[
:cannot_push_to_read_only
]
ERROR_MESSAGES
[
:cannot_push_to_read_only
]
end
end
def
repository
project
.
repository
end
end
end
end
end
lib/gitlab/git_access_wiki.rb
View file @
ea18e1bf
...
@@ -28,5 +28,11 @@ module Gitlab
...
@@ -28,5 +28,11 @@ module Gitlab
def
push_to_read_only_message
def
push_to_read_only_message
ERROR_MESSAGES
[
:read_only
]
ERROR_MESSAGES
[
:read_only
]
end
end
private
def
repository
project
.
wiki
.
repository
end
end
end
end
end
spec/lib/gitlab/git_access_wiki_spec.rb
View file @
ea18e1bf
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
Gitlab
::
GitAccessWiki
do
describe
Gitlab
::
GitAccessWiki
do
let
(
:access
)
{
described_class
.
new
(
user
,
project
,
'web'
,
authentication_abilities:
authentication_abilities
,
redirected_path:
redirected_path
)
}
let
(
:access
)
{
described_class
.
new
(
user
,
project
,
'web'
,
authentication_abilities:
authentication_abilities
,
redirected_path:
redirected_path
)
}
let
(
:project
)
{
create
(
:project
,
:
repository
)
}
let
(
:project
)
{
create
(
:project
,
:
wiki_repo
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:changes
)
{
[
'6f6d7e7ed 570e7b2ab refs/heads/master'
]
}
let
(
:changes
)
{
[
'6f6d7e7ed 570e7b2ab refs/heads/master'
]
}
let
(
:redirected_path
)
{
nil
}
let
(
:redirected_path
)
{
nil
}
...
@@ -48,6 +48,18 @@ describe Gitlab::GitAccessWiki do
...
@@ -48,6 +48,18 @@ describe Gitlab::GitAccessWiki do
it
'give access to download wiki code'
do
it
'give access to download wiki code'
do
expect
{
subject
}.
not_to
raise_error
expect
{
subject
}.
not_to
raise_error
end
end
context
'when the wiki repository does not exist'
do
it
'returns not found'
do
wiki_repo
=
project
.
wiki
.
repository
FileUtils
.
rm_rf
(
wiki_repo
.
path
)
# Sanity check for rm_rf
expect
(
wiki_repo
.
exists?
).
to
eq
(
false
)
expect
{
subject
}.
to
raise_error
(
Gitlab
::
GitAccess
::
UnauthorizedError
,
'A repository for this project does not exist yet.'
)
end
end
end
end
context
'when wiki feature is disabled'
do
context
'when wiki feature is disabled'
do
...
...
spec/requests/api/internal_spec.rb
View file @
ea18e1bf
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
API
::
Internal
do
describe
API
::
Internal
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:key
)
{
create
(
:key
,
user:
user
)
}
let
(
:key
)
{
create
(
:key
,
user:
user
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
:wiki_repo
)
}
let
(
:secret_token
)
{
Gitlab
::
Shell
.
secret_token
}
let
(
:secret_token
)
{
Gitlab
::
Shell
.
secret_token
}
let
(
:gl_repository
)
{
"project-
#{
project
.
id
}
"
}
let
(
:gl_repository
)
{
"project-
#{
project
.
id
}
"
}
let
(
:reference_counter
)
{
double
(
'ReferenceCounter'
)
}
let
(
:reference_counter
)
{
double
(
'ReferenceCounter'
)
}
...
...
spec/requests/git_http_spec.rb
View file @
ea18e1bf
...
@@ -150,7 +150,7 @@ describe 'Git HTTP requests' do
...
@@ -150,7 +150,7 @@ describe 'Git HTTP requests' do
let
(
:path
)
{
"/
#{
wiki
.
repository
.
full_path
}
.git"
}
let
(
:path
)
{
"/
#{
wiki
.
repository
.
full_path
}
.git"
}
context
"when the project is public"
do
context
"when the project is public"
do
let
(
:project
)
{
create
(
:project
,
:
repository
,
:public
,
:wiki_enabled
)
}
let
(
:project
)
{
create
(
:project
,
:
wiki_repo
,
:public
,
:wiki_enabled
)
}
it_behaves_like
'pushes require Basic HTTP Authentication'
it_behaves_like
'pushes require Basic HTTP Authentication'
...
@@ -177,7 +177,7 @@ describe 'Git HTTP requests' do
...
@@ -177,7 +177,7 @@ describe 'Git HTTP requests' do
end
end
context
'but the repo is disabled'
do
context
'but the repo is disabled'
do
let
(
:project
)
{
create
(
:project
,
:
repository
,
:public
,
:repository_disabled
,
:wiki_enabled
)
}
let
(
:project
)
{
create
(
:project
,
:
wiki_repo
,
:public
,
:repository_disabled
,
:wiki_enabled
)
}
it_behaves_like
'pulls are allowed'
it_behaves_like
'pulls are allowed'
it_behaves_like
'pushes are allowed'
it_behaves_like
'pushes are allowed'
...
@@ -198,7 +198,7 @@ describe 'Git HTTP requests' do
...
@@ -198,7 +198,7 @@ describe 'Git HTTP requests' do
end
end
context
"when the project is private"
do
context
"when the project is private"
do
let
(
:project
)
{
create
(
:project
,
:
repository
,
:private
,
:wiki_enabled
)
}
let
(
:project
)
{
create
(
:project
,
:
wiki_repo
,
:private
,
:wiki_enabled
)
}
it_behaves_like
'pulls require Basic HTTP Authentication'
it_behaves_like
'pulls require Basic HTTP Authentication'
it_behaves_like
'pushes require Basic HTTP Authentication'
it_behaves_like
'pushes require Basic HTTP Authentication'
...
@@ -210,7 +210,7 @@ describe 'Git HTTP requests' do
...
@@ -210,7 +210,7 @@ describe 'Git HTTP requests' do
end
end
context
'but the repo is disabled'
do
context
'but the repo is disabled'
do
let
(
:project
)
{
create
(
:project
,
:
repository
,
:private
,
:repository_disabled
,
:wiki_enabled
)
}
let
(
:project
)
{
create
(
:project
,
:
wiki_repo
,
:private
,
:repository_disabled
,
:wiki_enabled
)
}
it
'allows clones'
do
it
'allows clones'
do
download
(
path
,
user:
user
.
username
,
password:
user
.
password
)
do
|
response
|
download
(
path
,
user:
user
.
username
,
password:
user
.
password
)
do
|
response
|
...
...
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