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
ce8d0a4f
Commit
ce8d0a4f
authored
Jan 20, 2016
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Write specs to cover cases when pushing with or without git annex and how git_hooks get triggered.
parent
d9ac4023
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
0 deletions
+69
-0
config/gitlab.yml.example
config/gitlab.yml.example
+5
-0
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+1
-0
spec/lib/gitlab/git_access_spec.rb
spec/lib/gitlab/git_access_spec.rb
+63
-0
No files found.
config/gitlab.yml.example
View file @
ce8d0a4f
...
...
@@ -496,6 +496,11 @@ production: &base
# If you use non-standard ssh port you need to specify it
# ssh_port: 22
# git-annex support (EE only)
# If this setting is set to true, the same setting in config.yml of
# gitlab-shell needs to be set to true
# git_annex_enabled: false
## Git settings
# CAUTION!
# Use the default values unless you really know what you are doing
...
...
config/initializers/1_settings.rb
View file @
ce8d0a4f
...
...
@@ -340,6 +340,7 @@ Settings.gitlab_shell['ssh_port'] ||= 22
Settings
.
gitlab_shell
[
'ssh_user'
]
||=
Settings
.
gitlab
.
user
Settings
.
gitlab_shell
[
'owner_group'
]
||=
Settings
.
gitlab
.
user
Settings
.
gitlab_shell
[
'ssh_path_prefix'
]
||=
Settings
.
send
(
:build_gitlab_shell_ssh_path_prefix
)
Settings
.
gitlab_shell
[
'git_annex_enabled'
]
||=
false
#
# Backup
...
...
spec/lib/gitlab/git_access_spec.rb
View file @
ce8d0a4f
...
...
@@ -5,6 +5,10 @@ describe Gitlab::GitAccess, lib: true do
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:actor
)
{
user
}
let
(
:git_annex_changes
)
do
[
"6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/synced/git-annex"
,
"6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/synced/named-branch"
]
end
describe
'can_push_to_branch?'
do
describe
'push to none protected branch'
do
...
...
@@ -244,6 +248,65 @@ describe Gitlab::GitAccess, lib: true do
end
end
end
context
"when using git annex"
do
before
{
project
.
team
<<
[
user
,
:master
]
}
describe
'and git hooks unset'
do
describe
'git annex enabled'
do
before
{
allow
(
Gitlab
.
config
.
gitlab_shell
).
to
receive
(
:git_annex_enabled
).
and_return
(
true
)
}
it
{
expect
(
access
.
push_access_check
(
git_annex_changes
)).
to
be_allowed
}
end
describe
'git annex disabled'
do
before
{
allow
(
Gitlab
.
config
.
gitlab_shell
).
to
receive
(
:git_annex_enabled
).
and_return
(
false
)
}
it
{
expect
(
access
.
push_access_check
(
git_annex_changes
)).
to
be_allowed
}
end
end
describe
'and git hooks set'
do
before
{
project
.
create_git_hook
}
describe
'check commit author email'
do
before
do
project
.
git_hook
.
update
(
author_email_regex:
"@only.com"
)
end
describe
'git annex enabled'
do
before
{
allow
(
Gitlab
.
config
.
gitlab_shell
).
to
receive
(
:git_annex_enabled
).
and_return
(
true
)
}
it
{
expect
(
access
.
push_access_check
(
git_annex_changes
)).
to
be_allowed
}
end
describe
'git annex disabled'
do
before
{
allow
(
Gitlab
.
config
.
gitlab_shell
).
to
receive
(
:git_annex_enabled
).
and_return
(
false
)
}
it
{
expect
(
access
.
push_access_check
(
git_annex_changes
)).
to_not
be_allowed
}
end
end
describe
'check commit author email'
do
before
do
allow_any_instance_of
(
Gitlab
::
Git
::
Blob
).
to
receive
(
:size
).
and_return
(
5
.
megabytes
.
to_i
)
project
.
git_hook
.
update
(
max_file_size:
2
)
end
describe
'git annex enabled'
do
before
{
allow
(
Gitlab
.
config
.
gitlab_shell
).
to
receive
(
:git_annex_enabled
).
and_return
(
true
)
}
it
{
expect
(
access
.
push_access_check
(
git_annex_changes
)).
to
be_allowed
}
end
describe
'git annex disabled'
do
before
{
allow
(
Gitlab
.
config
.
gitlab_shell
).
to
receive
(
:git_annex_enabled
).
and_return
(
false
)
}
it
{
expect
(
access
.
push_access_check
(
git_annex_changes
)).
to_not
be_allowed
}
end
end
end
end
end
describe
"git_hook_check"
do
...
...
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