summaryrefslogtreecommitdiff
path: root/app/models/repository.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r--app/models/repository.rb22
1 files changed, 13 insertions, 9 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index acc720ccfa3..eb232ea681b 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -39,7 +39,7 @@ class Repository
# Return absolute path to repository
def path_to_repo
@path_to_repo ||= File.expand_path(
- File.join(Gitlab.config.gitlab_shell.repos_path, path_with_namespace + ".git")
+ File.join(@project.repository_storage_path, path_with_namespace + ".git")
)
end
@@ -246,24 +246,26 @@ class Repository
end
end
+ # Keys for data that can be affected for any commit push.
def cache_keys
- %i(size branch_names tag_names branch_count tag_count commit_count
+ %i(size commit_count
readme version contribution_guide changelog
license_blob license_key gitignore)
end
+ # Keys for data on branch/tag operations.
+ def cache_keys_for_branches_and_tags
+ %i(branch_names tag_names branch_count tag_count)
+ end
+
def build_cache
- cache_keys.each do |key|
+ (cache_keys + cache_keys_for_branches_and_tags).each do |key|
unless cache.exist?(key)
send(key)
end
end
end
- def expire_gitignore
- cache.expire(:gitignore)
- end
-
def expire_tags_cache
cache.expire(:tag_names)
@tags = nil
@@ -286,8 +288,6 @@ class Repository
# This ensures this particular cache is flushed after the first commit to a
# new repository.
expire_emptiness_caches if empty?
- expire_branch_count_cache
- expire_tag_count_cache
end
def expire_branch_cache(branch_name = nil)
@@ -978,6 +978,10 @@ class Repository
raw_repository.ls_files(actual_ref)
end
+ def gitattribute(path, name)
+ raw_repository.attributes(path)[name]
+ end
+
def copy_gitattributes(ref)
actual_ref = ref || root_ref
begin