Skip to content
Snippets Groups Projects

Fetch the merged branches at once

Open username-removed-423915 requested to merge use-git-branch-merged into master

What does this MR do?

Fetch the merged branches at once, instead of checking it one by one in the view. We don't cache this yet because this would already much improve the performance.

Are there points in the code the reviewer needs to double check?

Previously we could be checking with Gitaly, but with this change we would be using git command line. Could this kill the filesystem?

Why was this MR needed?

A naive test against a particularly large repository:

begin
  now = Time.now
  branches.map{ |b| repository.merged_to_root_ref?(b.name) }
  Time.now - now
end # 8.265830782

Around 10 times faster:

begin
  now = Time.now
  repository.merged_branches(branches.map(&:name))
  Time.now - now
end # 0.807405397

This should make the branches page usable.

Screenshots (if relevant)

Does this MR meet the acceptance criteria?

  • Changelog entry added, if necessary
  • Tests added for this feature/bug
  • Review
    • Has been reviewed by Backend

What are the relevant issue numbers?

This is a follow up from https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14678#note_42548019

Edited by username-removed-423915

Merge request reports

Pipeline #12530977 passed with warnings

Pipeline passed with warnings on use-git-branch-merged

Test coverage 72.44% (0.00%) from 2 jobs
Requires 1 approval from eligible users.
The source branch use-git-branch-merged does not exist. Please restore it or use a different source branch.

Merge details

  • 1 commit and 1 merge commit will be added to master.
  • Source branch will be deleted.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading