summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLuke Duncalfe <lduncalfe@eml.cc>2019-03-14 17:20:40 +1300
committerLuke Duncalfe <lduncalfe@eml.cc>2019-03-18 13:03:23 +1300
commit8ef0a9d5cae654eb6d5515f776bf7eb519327915 (patch)
tree06ff6d0605fcb35cf30ae76499e2391ef6faad62 /lib
parent1715622c054434abc752c7be11ec4daec9231d5a (diff)
downloadgitlab-ce-8ef0a9d5cae654eb6d5515f776bf7eb519327915.tar.gz
Enrich commits with full data in CommitCollection
Allow incomplete commit records to load their full data from gitaly. Commits can be based on a Hash of data retrieved from PostgreSQL, and this data can be intentionally incomplete in order to save space. A new method #gitaly? has been added to Gitlab::Git::Commit, which returns true if the underlying data source of the Commit is a Gitaly::GitCommit. CommitCollection now has a method #enrich which replaces non-gitaly commits in place with commits from gitaly. CommitCollection#without_merge_commits has been updated to call this method, as in order to determine a merge commit we need to have parent data. Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/58805
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/git/commit.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/gitlab/git/commit.rb b/lib/gitlab/git/commit.rb
index e5bbd500e98..798deb1be4a 100644
--- a/lib/gitlab/git/commit.rb
+++ b/lib/gitlab/git/commit.rb
@@ -311,6 +311,10 @@ module Gitlab
parent_ids.size > 1
end
+ def gitaly_commit?
+ raw_commit.is_a?(Gitaly::GitCommit)
+ end
+
def tree_entry(path)
return unless path.present?
@@ -333,7 +337,7 @@ module Gitlab
end
def to_gitaly_commit
- return raw_commit if raw_commit.is_a?(Gitaly::GitCommit)
+ return raw_commit if gitaly_commit?
message_split = raw_commit.message.split("\n", 2)
Gitaly::GitCommit.new(