diff options
Diffstat (limited to 'app/models/snippet.rb')
-rw-r--r-- | app/models/snippet.rb | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/app/models/snippet.rb b/app/models/snippet.rb index b04fca64c87..38aaeff5c9a 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -350,24 +350,10 @@ class Snippet < ApplicationRecord snippet_repository&.shard_name || Repository.pick_storage_shard end - # Repositories are created with a default branch. This branch - # can be different from the default branch set in the platform. - # This method changes the `HEAD` file to point to the existing - # default branch in case it's different. - def change_head_to_default_branch - return unless repository.exists? - # All snippets must have at least 1 file. Therefore, if - # `HEAD` is empty is because it's pointing to the wrong - # default branch - return unless repository.empty? || list_files('HEAD').empty? - - repository.raw_repository.write_ref('HEAD', "refs/heads/#{default_branch}") - end - def create_repository return if repository_exists? && snippet_repository - repository.create_if_not_exists + repository.create_if_not_exists(default_branch) track_snippet_repository(repository.storage) end |