0
votes

After updating Gitlab to version 7 when creating a merge request, we get a list of commits that is much larger than expected. It is providing a list of 1000+ commits when there should be 5.

Going through the source code, I am unable to find where it is that Gitlab is determining which commits to use for the merge request in order to debug that. I found the following in compare_service.rb but am at a loss as to where to go from here.

# Compare 2 branches for one repo or between repositories
# and return Gitlab::CompareResult object that responds to commits and diffs
class CompareService
  def execute(current_user, source_project, source_branch, target_project, target_branch)
    # Try to compare branches to get commits list and diffs
    #
    # Note: Use satellite only when need to compare between two repos
    # because satellites are slower than operations on bare repo
    if target_project == source_project
      Gitlab::CompareResult.new(
        Gitlab::Git::Compare.new(
          target_project.repository.raw_repository,
          target_branch,
          source_branch,
        )
      )
    else
      Gitlab::Satellite::CompareAction.new(
        current_user,
        target_project,
        target_branch,
        source_project,
        source_branch
      ).result
    end
  end
end

Where is Gitlab getting the SHA's of the commits that are not merged into the target branch?

1
"Where is Gitlab getting the SHA's of the commits that are not merged into the target branch?" source_branch / repo and target_branch / repo? You'd have to look where those are coming from.Ciro Santilli 新疆再教育营六四事件法轮功郝海东
@CiroSantilli I know where those are coming from, but I am not able to find the actual code that is examining the Repo for getting the list of commits. Gitlab::Git::Compare.new doesn't make any sense to me.Schleis
Maybe you know this, but if not it might help: right now, gitlab has two backends: grit (forked) and is migrating to rugged. To help the migration it uses the gitlab_git gem as front-end for both, which implements Gitlab::Git (which is very confusing IMHO, since it's a Gitlab module outside of gitlab...). github.com/gitlabhq/gitlab_gitCiro Santilli 新疆再教育营六四事件法轮功郝海东
@CiroSantilli Thank you, that is the piece that I was missing. I wasn't aware of the gem and didn't know to look there.Schleis

1 Answers

0
votes

It is a problem in rugged 0.21.0. Hopefully this will be soon updated in official repo but you can fix this on your own by editing /home/git/gitlab/Gemfile.lock and searching for rugged lib. Update version from 0.21.0 to 0.21.2.

Run bundle install afterwards:

# MySQL installations (note: the line below states '--without ... postgres')
sudo -u git -H bundle install --without development test postgres --deployment

# PostgreSQL installations (note: the line below states '--without ... mysql')
sudo -u git -H bundle install --without development test mysql --deployment