Uploaded image for project: 'Bitbucket Cloud'
  1. Bitbucket Cloud
  2. BCLOUD-13182

Orochi's Git merge preview fails to merge commits with themselves

    XMLWordPrintable

Details

    Description

      In [3]: cs = r.lookup('7f448db208471e2ed562532821494703e31bdb04')
      In [5]: with cs.previewmerge(cs, &#x27;sadfads&#x27;, &#x27;asdf <asdf@asf.sadf>&#x27;) as m:
          print m
      <GitChangeset 7f448db20847>
      

      Merge-previewing a commit with itself causes fetchandmerge() to return as the new merge commit the one that was provided as input. This in turn means that when Bitbucket then calls diff() and patch() on it, it shows the diff against its parent, instead of an expected empty diff.

      This happens because fetchandmerge shells out to git telling it to merge the current commit with itself. It detects that, prints "Already up-to-date." and exists with a 0 status code. Orochi, not seeing and error, interprets this as a successful merge, looking up the new HEAD and returning it as the merge commit.

      Expected: we should either not support merging a commit with itself; raise an exception and make it the caller's problem, or we should do what the caller asks and explicitly create an empty merge commit (recommended).

      Attachments

        Activity

          People

            Unassigned Unassigned
            c3f02a31ee6f seanfarley
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: