1. 25 Mar, 2019 6 commits
    • Luke Duncalfe's avatar
      Add changelog entry · 1b2c40cf
      Luke Duncalfe authored
      1b2c40cf
    • Luke Duncalfe's avatar
      Add changelog entry · f51ee0fa
      Luke Duncalfe authored
      f51ee0fa
    • Luke Duncalfe's avatar
      Update ee specs to correctly select MR author · bcb756cf
      Luke Duncalfe authored
      When ce MR https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/26144
      was merged in, it caused failures in ee specs
      https://gitlab.com/gitlab-org/gitlab-ee/issues/10567.
      
      The fix for these specs is to select an "author" of the MR by first
      filtering merge commits from the commit collection. This mirrors the
      behaviour of MergeRequest#authors.
      
      Previously, this test passed as MergeRequest#commits would always return
      commits that lacked parent_ids, as they are initialized from data
      kept in MergeRequestDiffCommit which does not have parent_ids data. This
      meant that all MR commits were considered not to be merge commits, even
      though in gitaly some did have parent ids.
      
      However, now, CommitCollection#enrich! is called
      CommitCollection#without_merge_commits is called (as it is when
      MergeRequest#authors is called), so commit data is fetched from gitaly
      and now have parent_ids data. This cause the tests to fail, because the
      "author" being chosen from the merge request commits was in fact the
      user who had committed a merge commit.
      bcb756cf
    • Luke Duncalfe's avatar
      Handle blank projects in CommitCollection#enrich! · 4844018b
      Luke Duncalfe authored
      A project is needed in order to fetch data from gitaly. Projects can be
      absent from commits in certain rare situations (like when viewing a MR
      of a deleted fork). In these cases, assume that the enriched data is not
      needed.
      
      See this comment:
      
      https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/26144#note_152191106
      
      "It's led to a dilemma about where to "fix" this in code. I'm going
      to fix it by allowing CommitCollection#enrich! to just return unenriched
      commits when a project is missing, essentially "silently failing". I
      hope this is the right decision. It's going with the assumption that
      calls in these situations in the future are not needing the full data.
      The alternative would be to allow CommitCollection#enrich! to still
      error, but handle it in the methods that call #enrich!, however that
      might lead to brittleness in future when working with project-less MRs."
      4844018b
    • Luke Duncalfe's avatar
      Scope out merge commits in MergeRequest spec · ae13abe4
      Luke Duncalfe authored
      Previously the code for excluding merge commits from the commit
      collection (CommitCollection#without_merge_commits) was not working
      when the commits had come from a merge request. Now that this has been
      fixed, these tests fails. They should always have been written to
      exclude merge commits when comparing.
      ae13abe4
    • Luke Duncalfe's avatar
      Enrich commits with full data in CommitCollection · 7d3d34dd
      Luke Duncalfe authored
      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
      7d3d34dd
  2. 21 Mar, 2019 7 commits
  3. 20 Mar, 2019 27 commits