Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r--app/models/repository.rb18
1 files changed, 12 insertions, 6 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 9039bdf1a20..eb8e45877f3 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -244,10 +244,10 @@ class Repository
end
end
- def add_branch(user, branch_name, ref)
+ def add_branch(user, branch_name, ref, expire_cache: true)
branch = raw_repository.add_branch(branch_name, user: user, target: ref)
- after_create_branch
+ after_create_branch(expire_cache: expire_cache)
branch
rescue Gitlab::Git::Repository::InvalidRef
@@ -337,11 +337,17 @@ class Repository
def expire_branches_cache
expire_method_caches(%i(branch_names merged_branch_names branch_count has_visible_content? has_ambiguous_refs?))
+ expire_protected_branches_cache
+
@local_branches = nil
@branch_exists_memo = nil
@branch_names_include = nil
end
+ def expire_protected_branches_cache
+ ProtectedBranches::CacheService.new(project).refresh if project # rubocop:disable CodeReuse/ServiceClass
+ end
+
def expire_statistics_caches
expire_method_caches(%i(size commit_count))
end
@@ -646,8 +652,8 @@ class Repository
return if licensee_object.name.blank?
licensee_object
- rescue Licensee::InvalidLicense => ex
- Gitlab::ErrorTracking.track_exception(ex)
+ rescue Licensee::InvalidLicense => e
+ Gitlab::ErrorTracking.track_exception(e)
nil
end
memoize_method :license
@@ -1072,9 +1078,9 @@ class Repository
) do |commit_id|
merge_request.update!(rebase_commit_sha: commit_id, merge_error: nil)
end
- rescue StandardError => error
+ rescue StandardError => e
merge_request.update!(rebase_commit_sha: nil)
- raise error
+ raise e
end
def squash(user, merge_request, message)