Commit 5f0b50db7aaa3d10bf2b49d5fb7ca55d6f3ccd10

Authored by Dmitriy Zaporozhets
1 parent 44ac961b

Discover default branch on project creationg

Showing 1 changed file with 7 additions and 2 deletions   Show diff stats
app/contexts/projects/create_context.rb
... ... @@ -48,6 +48,7 @@ module Projects
48 48 # Import project from cloneable resource
49 49 if @project.valid? && @project.import_url.present?
50 50 shell = Gitlab::Shell.new
  51 +
51 52 if shell.import_repository(@project.path_with_namespace, @project.import_url)
52 53 # We should create satellite for imported repo
53 54 @project.satellite.create unless @project.satellite.exists?
... ... @@ -58,8 +59,12 @@ module Projects
58 59 end
59 60 end
60 61  
61   - if @project.save && !@project.group
62   - @project.users_projects.create(project_access: UsersProject::MASTER, user: current_user)
  62 + if @project.save
  63 + unless @project.group
  64 + @project.users_projects.create(project_access: UsersProject::MASTER, user: current_user)
  65 + end
  66 +
  67 + @project.discover_default_branch
63 68 end
64 69  
65 70 @project
... ...