summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/services/create_branch_service.rb2
-rw-r--r--app/views/projects/branches/new.html.haml1
-rw-r--r--features/steps/project/commits/branches.rb2
3 files changed, 3 insertions, 2 deletions
diff --git a/app/services/create_branch_service.rb b/app/services/create_branch_service.rb
index de18f3bc556..6a77f51628e 100644
--- a/app/services/create_branch_service.rb
+++ b/app/services/create_branch_service.rb
@@ -4,7 +4,7 @@ class CreateBranchService < BaseService
def execute(branch_name, ref)
valid_branch = Gitlab::GitRefValidator.validate(branch_name)
if valid_branch == false
- return error('Branch name invalid')
+ return error("Branch name can't contains space, '~', '^', ':', '?', '*', '[', '\', '..', '@{', and consecutive slashes, start with '/' or '.' or end in '/' or '.' or '.lock'")
end
repository = project.repository
diff --git a/app/views/projects/branches/new.html.haml b/app/views/projects/branches/new.html.haml
index 31943a2407a..4e94f2a5ea2 100644
--- a/app/views/projects/branches/new.html.haml
+++ b/app/views/projects/branches/new.html.haml
@@ -14,6 +14,7 @@
= label_tag :branch_name, nil, class: 'control-label'
.col-sm-10
= text_field_tag :branch_name, params[:branch_name], required: true, tabindex: 1, autofocus: true, class: 'form-control'
+ .help-block Can't contains space, '~', '^', ':', '?', '*', '[', '\', '..', '@{', and consecutive slashes, start with '/' or '.' or end in '/' or '.' or '.lock'
.form-group
= label_tag :ref, 'Create from', class: 'control-label'
.col-sm-10
diff --git a/features/steps/project/commits/branches.rb b/features/steps/project/commits/branches.rb
index 338f5e8d3ee..e9312e87637 100644
--- a/features/steps/project/commits/branches.rb
+++ b/features/steps/project/commits/branches.rb
@@ -61,7 +61,7 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps
end
step 'I should see new an error that branch is invalid' do
- expect(page).to have_content 'Branch name invalid'
+ expect(page).to have_content "Branch name can't contains space, '~', '^', ':', '?', '*', '[', '\', '..', '@{', and consecutive slashes, start with '/' or '.' or end in '/' or '.' or '.lock'"
end
step 'I should see new an error that ref is invalid' do