Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/branches/create_service.rb')
-rw-r--r--app/services/branches/create_service.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/services/branches/create_service.rb b/app/services/branches/create_service.rb
index 848e6aaa65a..b5faf2ec281 100644
--- a/app/services/branches/create_service.rb
+++ b/app/services/branches/create_service.rb
@@ -9,12 +9,16 @@ module Branches
return result if result[:status] == :error
- new_branch = repository.add_branch(current_user, branch_name, ref)
+ begin
+ new_branch = repository.add_branch(current_user, branch_name, ref)
+ rescue Gitlab::Git::CommandError => e
+ return error("Failed to create branch '#{branch_name}': #{e}")
+ end
if new_branch
success(new_branch)
else
- error("Invalid reference name: #{ref}")
+ error("Failed to create branch '#{branch_name}': invalid reference name '#{ref}'")
end
rescue Gitlab::Git::PreReceiveError => e
Gitlab::ErrorTracking.track_exception(e, pre_receive_message: e.raw_message, branch_name: branch_name, ref: ref)