Skip to content
  • Pierre de La Morinerie's avatar
    Fix MergeRequest#source_sha when there is no diff · 91b78a0e39cf
    Pierre de La Morinerie authored
    `MergeRequest#source_sha` is expected to return the sha of the source
    branch last commit.
    
    But when a open Merge Request has no diff (e.g. all commits have already
    been merged to the target branch), `merge_request.source_sha`
    incorrectly returns `nil`.
    
    This was un-noticed before – but now that !2217 has been merged,
    it makes `Gitlab::Git::Commit.between` raise an
    "Unexpected nil argument" exception.
    
    This fixes the crash, by making sure that `source_sha` returns a
    correct result even when there is no diff available.
    91b78a0e39cf