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
path: root/app
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2018-02-04 00:47:28 +0300
committerGrzegorz Bizon <grzegorz@gitlab.com>2018-02-04 00:47:28 +0300
commit5aea8dc1a6dc17d4a73e65f3c3a0f8b7e29686eb (patch)
tree036dd54a8a42575d5f0b6d3ef19a382476f2eb50 /app
parent91d2f92b1a09aa96e464962788cda57485c9a22f (diff)
parent05f17e4d720756cb5aea9e7697a6fa549372e536 (diff)
Merge branch 'fix/remove-duplicated-logic-between-model-and-lib-in-find-branch' into 'master'
Remove repo reloading logic from Repository#find_branch Closes #42609 See merge request gitlab-org/gitlab-ce!16815
Diffstat (limited to 'app')
-rw-r--r--app/models/repository.rb10
1 files changed, 1 insertions, 9 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index edfb236a91a..e46f167da75 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -173,15 +173,7 @@ class Repository
end
def find_branch(name, fresh_repo: true)
- # Since the Repository object may have in-memory index changes, invalidating the memoized Repository object may
- # cause unintended side effects. Because finding a branch is a read-only operation, we can safely instantiate
- # a new repo here to ensure a consistent state to avoid a libgit2 bug where concurrent access (e.g. via git gc)
- # 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 = fresh_repo ? initialize_raw_repository : raw_repository
-
- raw_repo.find_branch(name)
+ raw_repository.find_branch(name, fresh_repo)
end
def find_tag(name)