summaryrefslogtreecommitdiff
path: root/app/models/merge_request.rb
diff options
context:
space:
mode:
authorAdam Niedzielski <adamsunday@gmail.com>2017-06-26 17:36:09 +0200
committerAdam Niedzielski <adamsunday@gmail.com>2017-06-26 17:36:09 +0200
commit0eb3d18c569cbae0f4b58284857c7a21972c4153 (patch)
tree50d70b3ce1fb007457cebff4dfcad44fafdbb7f5 /app/models/merge_request.rb
parentd4384dc154cb1e44c7b0a5cd802d48629f585fdb (diff)
downloadgitlab-ce-0eb3d18c569cbae0f4b58284857c7a21972c4153.tar.gz
Store merge request ref_fetched status in the database34052-store-mr-ref-fetched-in-database
Closes #34052
Diffstat (limited to 'app/models/merge_request.rb')
-rw-r--r--app/models/merge_request.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index f581a25f093..c099d731082 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -771,6 +771,7 @@ class MergeRequest < ActiveRecord::Base
"refs/heads/#{source_branch}",
ref_path
)
+ update_column(:ref_fetched, true)
end
def ref_path
@@ -778,7 +779,13 @@ class MergeRequest < ActiveRecord::Base
end
def ref_fetched?
- project.repository.ref_exists?(ref_path)
+ super ||
+ begin
+ computed_value = project.repository.ref_exists?(ref_path)
+ update_column(:ref_fetched, true) if computed_value
+
+ computed_value
+ end
end
def ensure_ref_fetched