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
5f6dc362
Commit
5f6dc362
authored
Mar 02, 2020
by
Francisco Javier López
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow creating default branch in snippet repositories
parent
5b12631c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
0 deletions
+21
-0
changelogs/unreleased/fj-allow-create-snippet-default-branch.yml
...ogs/unreleased/fj-allow-create-snippet-default-branch.yml
+5
-0
lib/gitlab/checks/snippet_check.rb
lib/gitlab/checks/snippet_check.rb
+7
-0
spec/lib/gitlab/checks/snippet_check_spec.rb
spec/lib/gitlab/checks/snippet_check_spec.rb
+9
-0
No files found.
changelogs/unreleased/fj-allow-create-snippet-default-branch.yml
0 → 100644
View file @
5f6dc362
---
title
:
Allow creating default branch in snippet repositories
merge_request
:
26294
author
:
type
:
fixed
lib/gitlab/checks/snippet_check.rb
View file @
5f6dc362
...
...
@@ -3,6 +3,7 @@
module
Gitlab
module
Checks
class
SnippetCheck
<
BaseChecker
DEFAULT_BRANCH
=
'master'
.
freeze
ERROR_MESSAGES
=
{
create_delete_branch:
'You can not create or delete branches.'
}.
freeze
...
...
@@ -29,6 +30,12 @@ module Gitlab
true
end
private
def
creation?
@branch_name
!=
DEFAULT_BRANCH
&&
super
end
end
end
end
spec/lib/gitlab/checks/snippet_check_spec.rb
View file @
5f6dc362
...
...
@@ -25,10 +25,19 @@ describe Gitlab::Checks::SnippetCheck do
context
'trying to create the branch'
do
let
(
:oldrev
)
{
'0000000000000000000000000000000000000000'
}
let
(
:ref
)
{
'refs/heads/feature'
}
it
'raises an error'
do
expect
{
subject
.
exec
}.
to
raise_error
(
Gitlab
::
GitAccess
::
ForbiddenError
,
'You can not create or delete branches.'
)
end
context
"when branch is 'master'"
do
let
(
:ref
)
{
'refs/heads/master'
}
it
"allows the operation"
do
expect
{
subject
.
exec
}.
not_to
raise_error
end
end
end
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