This is to avoid a merge commit when fast-forwarding is possible.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
# check for rebased stack. In this case we emulate a merge with the stack
# base by setting two parents.
merge_bases = repository.get_merge_bases(public_head, stack.base)
# check for rebased stack. In this case we emulate a merge with the stack
# base by setting two parents.
merge_bases = repository.get_merge_bases(public_head, stack.base)
+ if public_head in merge_bases:
+ # fast-forward the public ref
+ repository.refs.set(public_ref, stack.head, 'publish')
+ out.info('Fast-forwarded "%s"' % public_ref)
+ return
if not stack.base in merge_bases:
message = 'Merge %s into %s' % (repository.describe(stack.base).strip(),
utils.strip_prefix('refs/heads/',
if not stack.base in merge_bases:
message = 'Merge %s into %s' % (repository.describe(stack.base).strip(),
utils.strip_prefix('refs/heads/',