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

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Fargher <proglottis@gmail.com>2020-03-16 05:44:31 +0300
committerJames Fargher <proglottis@gmail.com>2020-03-16 05:44:31 +0300
commita04e18c024c184fb8270730a50e9b9f3085cfd53 (patch)
tree741267e669dc806c74ab1eed11c15738e4b89343
parent9c002c8644b6935bc1104f74603c0d1f319f2291 (diff)
parent44b9cc211fc8c89eb1a394a6fa78747c65e5d762 (diff)
Merge branch 'zj-rugged-bare' into 'master'
Use Rugged::Repository#bare over #new See merge request gitlab-org/gitaly!1920
-rw-r--r--changelogs/unreleased/zj-rugged-bare.yml5
-rw-r--r--ruby/lib/gitlab/git/repository.rb4
2 files changed, 8 insertions, 1 deletions
diff --git a/changelogs/unreleased/zj-rugged-bare.yml b/changelogs/unreleased/zj-rugged-bare.yml
new file mode 100644
index 000000000..f41ed7646
--- /dev/null
+++ b/changelogs/unreleased/zj-rugged-bare.yml
@@ -0,0 +1,5 @@
+---
+title: 'Use Rugged::Repository#bare over #new'
+merge_request: 1920
+author:
+type: performance
diff --git a/ruby/lib/gitlab/git/repository.rb b/ruby/lib/gitlab/git/repository.rb
index 78feb3555..af9feda30 100644
--- a/ruby/lib/gitlab/git/repository.rb
+++ b/ruby/lib/gitlab/git/repository.rb
@@ -130,7 +130,9 @@ module Gitlab
def rugged
@rugged ||= begin
- Rugged::Repository.new(path, alternates: alternate_object_directories).tap do |repo|
+ # Open in bare mode, for a slight performance gain
+ # https://github.com/libgit2/rugged/blob/654ff2fe12041e09707ba0647307abcb6348a7fb/ext/rugged/rugged_repo.c#L276-L278
+ Rugged::Repository.bare(path, alternates: alternate_object_directories).tap do |repo|
Thread.current[RUGGED_KEY] << repo if Thread.current[RUGGED_KEY]
end
end