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
diff options
context:
space:
mode:
Diffstat (limited to 'app/finders/merge_requests/oldest_per_commit_finder.rb')
-rw-r--r--app/finders/merge_requests/oldest_per_commit_finder.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/app/finders/merge_requests/oldest_per_commit_finder.rb b/app/finders/merge_requests/oldest_per_commit_finder.rb
index 5da7a08e36c..16b5964e242 100644
--- a/app/finders/merge_requests/oldest_per_commit_finder.rb
+++ b/app/finders/merge_requests/oldest_per_commit_finder.rb
@@ -18,8 +18,8 @@ module MergeRequests
mapping = {}
shas = commits.map(&:id)
- # To include merge requests by the merge/squash SHA, we don't need to go
- # through any diff rows.
+ # To include merge requests by the merged/merge/squash SHA, we don't need
+ # to go through any diff rows.
#
# We can't squeeze all this into a single query, as the diff based data
# relies on a GROUP BY. On the other hand, retrieving MRs by their merge
@@ -27,17 +27,19 @@ module MergeRequests
@project
.merge_requests
.preload_target_project
- .by_merge_or_squash_commit_sha(shas)
+ .by_merged_or_merge_or_squash_commit_sha(shas)
.each do |mr|
- # Merge/squash SHAs can't be in the merge request itself. It _is_
- # possible a newer merge request includes the commit, but in that case
- # we still want the oldest merge request.
+ # SHAs for merge commits, squash commits, and rebased source SHAs,
+ # can't be in the merge request source branch. It _is_ possible a
+ # newer merge request includes the commit, but in that case we still
+ # want the oldest merge request.
#
# It's also possible that a merge request produces both a squashed
# commit and a merge commit. In that case we want to store the mapping
# for both the SHAs.
mapping[mr.squash_commit_sha] = mr if mr.squash_commit_sha
mapping[mr.merge_commit_sha] = mr if mr.merge_commit_sha
+ mapping[mr.merged_commit_sha] = mr if mr.merged_commit_sha
end
remaining = shas - mapping.keys