Details
-
Bug
-
Resolution: Timed out
-
Low
Description
In [3]: cs = r.lookup('7f448db208471e2ed562532821494703e31bdb04') In [5]: with cs.previewmerge(cs, 'sadfads', 'asdf <asdf@asf.sadf>') 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).