diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-09-26 10:03:57 +0530 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2016-09-26 18:38:40 +0530 |
commit | c0ecef79fe936b9e71384f8d951fc5503f26f4a7 (patch) | |
tree | f1be52fe5ff1773036defe22f5f7d232cac3c40c /spec/support | |
parent | f1bfb872877df7baf36d2de1ad5dfdb4c8604c9b (diff) | |
download | gitlab-ce-c0ecef79fe936b9e71384f8d951fc5503f26f4a7.tar.gz |
Fix the "Commits" section of the cycle analytics summary.
- The commit count was capped at 10, due to
`Gitlab::Git::Repository#log` enforcing a limit, with the default set
to 10.
- Reimplement a small portion of this `log` function to get just the
data we need.
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/cycle_analytics_helpers.rb | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/spec/support/cycle_analytics_helpers.rb b/spec/support/cycle_analytics_helpers.rb index e8e760a6187..62a5b46d47b 100644 --- a/spec/support/cycle_analytics_helpers.rb +++ b/spec/support/cycle_analytics_helpers.rb @@ -4,24 +4,28 @@ module CycleAnalyticsHelpers create_commit("Commit for ##{issue.iid}", issue.project, user, branch_name) end - def create_commit(message, project, user, branch_name) - filename = random_git_name + def create_commit(message, project, user, branch_name, count: 1) oldrev = project.repository.commit(branch_name).sha + commit_shas = Array.new(count) do |index| + filename = random_git_name - options = { - committer: project.repository.user_to_committer(user), - author: project.repository.user_to_committer(user), - commit: { message: message, branch: branch_name, update_ref: true }, - file: { content: "content", path: filename, update: false } - } + options = { + committer: project.repository.user_to_committer(user), + author: project.repository.user_to_committer(user), + commit: { message: message, branch: branch_name, update_ref: true }, + file: { content: "content", path: filename, update: false } + } + + commit_sha = Gitlab::Git::Blob.commit(project.repository, options) + project.repository.commit(commit_sha) - commit_sha = Gitlab::Git::Blob.commit(project.repository, options) - project.repository.commit(commit_sha) + commit_sha + end GitPushService.new(project, user, oldrev: oldrev, - newrev: commit_sha, + newrev: commit_shas.last, ref: 'refs/heads/master').execute end |