diff options
author | Alejandro RodrÃguez <alejorro70@gmail.com> | 2017-02-15 23:08:30 -0300 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2017-04-04 16:53:44 +0200 |
commit | 267cd3e3594dcb1555b5018723f3cc620873499d (patch) | |
tree | 323bdac4cd84427ed64b9d2a0065eff9e762c340 /app | |
parent | 3301f4a22b685975d664ea8abdd7c43b3e929e5a (diff) | |
download | gitlab-ce-267cd3e3594dcb1555b5018723f3cc620873499d.tar.gz |
Incorporate Gitaly client for refs service
Diffstat (limited to 'app')
-rw-r--r-- | app/models/repository.rb | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 6b2383b73eb..f3c4cb851fb 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -59,7 +59,7 @@ class Repository def raw_repository return nil unless path_with_namespace - @raw_repository ||= Gitlab::Git::Repository.new(path_to_repo) + @raw_repository ||= create_raw_repository end # Return absolute path to repository @@ -146,12 +146,7 @@ class Repository # may cause the branch to "disappear" erroneously or have the wrong SHA. # # See: https://github.com/libgit2/libgit2/issues/1534 and https://gitlab.com/gitlab-org/gitlab-ce/issues/15392 - raw_repo = - if fresh_repo - Gitlab::Git::Repository.new(path_to_repo) - else - raw_repository - end + raw_repo = fresh_repo ? create_raw_repository : raw_repository raw_repo.find_branch(name) end @@ -505,9 +500,7 @@ class Repository end end - def branch_names - branches.map(&:name) - end + delegate :branch_names, to: :raw_repository cache_method :branch_names, fallback: [] delegate :tag_names, to: :raw_repository @@ -1168,4 +1161,8 @@ class Repository def repository_storage_path @project.repository_storage_path end + + def create_raw_repository + Gitlab::Git::Repository.new(project.repository_storage, path_with_namespace + '.git') + end end |