Commit 5f0b50db authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Discover default branch on project creationg

parent 44ac961b
...@@ -48,6 +48,7 @@ module Projects ...@@ -48,6 +48,7 @@ module Projects
# Import project from cloneable resource # Import project from cloneable resource
if @project.valid? && @project.import_url.present? if @project.valid? && @project.import_url.present?
shell = Gitlab::Shell.new shell = Gitlab::Shell.new
if shell.import_repository(@project.path_with_namespace, @project.import_url) if shell.import_repository(@project.path_with_namespace, @project.import_url)
# We should create satellite for imported repo # We should create satellite for imported repo
@project.satellite.create unless @project.satellite.exists? @project.satellite.create unless @project.satellite.exists?
...@@ -58,10 +59,14 @@ module Projects ...@@ -58,10 +59,14 @@ module Projects
end end
end end
if @project.save && !@project.group if @project.save
unless @project.group
@project.users_projects.create(project_access: UsersProject::MASTER, user: current_user) @project.users_projects.create(project_access: UsersProject::MASTER, user: current_user)
end end
@project.discover_default_branch
end
@project @project
rescue => ex rescue => ex
@project.errors.add(:base, "Can't save project. Please try again later") @project.errors.add(:base, "Can't save project. Please try again later")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment