• Pierre de La Morinerie's avatar
    Fix MergeRequest#source_sha when there is no diff · 18295585
    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.
    18295585
merge_requests.rb 2.73 KB