summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorMinqi Pan <pmq2001@gmail.com>2016-04-27 11:32:28 +0800
committerRémy Coutable <remy@rymai.me>2017-01-15 12:17:56 -0500
commitd7cdcc51bd38f8b95d08656d4711f04fe844fa23 (patch)
tree05ff04ca532ee03a1a3f4b1384de97af48fdde27 /app
parentf1bd9f05e2ca0c165f06c47c32d44f2951265e6e (diff)
downloadgitlab-ce-d7cdcc51bd38f8b95d08656d4711f04fe844fa23.tar.gz
Expire related caches after changing HEADpmq20/gitlab-ce-psvr/head/cache
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app')
-rw-r--r--app/models/project.rb2
-rw-r--r--app/models/repository.rb5
2 files changed, 6 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index e85d3d3bc6c..1630975b0d3 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1032,7 +1032,7 @@ class Project < ActiveRecord::Base
"refs/heads/#{branch}",
force: true)
repository.copy_gitattributes(branch)
- repository.expire_avatar_cache
+ repository.after_change_head
reload_default_branch
end
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 3266e9c75f0..43dba86e5ed 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -439,6 +439,11 @@ class Repository
expire_content_cache
end
+ # Runs code after the HEAD of a repository is changed.
+ def after_change_head
+ expire_method_caches(METHOD_CACHES_FOR_FILE_TYPES.keys)
+ end
+
# Runs code after a repository has been forked/imported.
def after_import
expire_content_cache