Commit 5f0b50db7aaa3d10bf2b49d5fb7ca55d6f3ccd10
1 parent
44ac961b
Exists in
master
and in
4 other branches
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,6 +48,7 @@ module Projects | ||
48 | # Import project from cloneable resource | 48 | # Import project from cloneable resource |
49 | if @project.valid? && @project.import_url.present? | 49 | if @project.valid? && @project.import_url.present? |
50 | shell = Gitlab::Shell.new | 50 | shell = Gitlab::Shell.new |
51 | + | ||
51 | if shell.import_repository(@project.path_with_namespace, @project.import_url) | 52 | if shell.import_repository(@project.path_with_namespace, @project.import_url) |
52 | # We should create satellite for imported repo | 53 | # We should create satellite for imported repo |
53 | @project.satellite.create unless @project.satellite.exists? | 54 | @project.satellite.create unless @project.satellite.exists? |
@@ -58,8 +59,12 @@ module Projects | @@ -58,8 +59,12 @@ module Projects | ||
58 | end | 59 | end |
59 | end | 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 | end | 68 | end |
64 | 69 | ||
65 | @project | 70 | @project |