Commit 02484930 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Removed Project#discover_default_branch since it not needed any more

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent c28786ec
......@@ -47,8 +47,6 @@ module Projects
@project.creator = current_user
if @project.save
@project.discover_default_branch
unless @project.group
@project.users_projects.create(
project_access: UsersProject::MASTER,
......
......@@ -62,10 +62,6 @@ class ProjectsController < ApplicationController
@events = event_filter.apply_filter(@events)
@events = @events.limit(limit).offset(params[:offset] || 0)
# Ensure project default branch is set if it possible
# Normally it defined on push or during creation
@project.discover_default_branch
respond_to do |format|
format.html do
if @project.empty_repo?
......
......@@ -302,14 +302,6 @@ class Project < ActiveRecord::Base
end
end
def discover_default_branch
# Discover the default branch, but only if it hasn't already been set to
# something else
if repository.exists? && default_branch.nil?
update_attributes(default_branch: self.repository.discover_default_branch)
end
end
def update_merge_requests(oldrev, newrev, ref, user)
return true unless ref =~ /heads/
branch_name = ref.gsub("refs/heads/", "")
......
......@@ -24,7 +24,6 @@ class GitPushService
create_push_event
project.ensure_satellite_exists
project.discover_default_branch
project.repository.expire_cache
if push_to_existing_branch?(ref, oldrev)
......
......@@ -14,7 +14,6 @@ class RepositoryImportWorker
project.imported = true
project.save
project.satellite.create unless project.satellite.exists?
project.discover_default_branch
else
project.imported = false
end
......
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