diff options
author | Luke Duncalfe <lduncalfe@eml.cc> | 2019-03-14 07:20:40 +0300 |
---|---|---|
committer | Luke Duncalfe <lduncalfe@eml.cc> | 2019-03-18 03:03:23 +0300 |
commit | 8ef0a9d5cae654eb6d5515f776bf7eb519327915 (patch) | |
tree | 06ff6d0605fcb35cf30ae76499e2391ef6faad62 /spec/lib | |
parent | 1715622c054434abc752c7be11ec4daec9231d5a (diff) |
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 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/git/commit_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git/commit_spec.rb b/spec/lib/gitlab/git/commit_spec.rb index 3fb41a626b2..4a4ac833e39 100644 --- a/spec/lib/gitlab/git/commit_spec.rb +++ b/spec/lib/gitlab/git/commit_spec.rb @@ -537,6 +537,18 @@ describe Gitlab::Git::Commit, :seed_helper do end end + describe '#gitaly_commit?' do + context 'when the commit data comes from gitaly' do + it { expect(commit.gitaly_commit?).to eq(true) } + end + + context 'when the commit data comes from a Hash' do + let(:commit) { described_class.new(repository, sample_commit_hash) } + + it { expect(commit.gitaly_commit?).to eq(false) } + end + end + describe '#has_zero_stats?' do it { expect(commit.has_zero_stats?).to eq(false) } end |