chiark / gitweb /
Fast-forward the published head when possible
authorCatalin Marinas <catalin.marinas@gmail.com>
Wed, 30 Sep 2009 20:52:35 +0000 (21:52 +0100)
committerCatalin Marinas <catalin.marinas@gmail.com>
Wed, 30 Sep 2009 20:52:35 +0000 (21:52 +0100)
This is to avoid a merge commit when fast-forwarding is possible.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
stgit/commands/publish.py

index d82991626252ceb3fddeb530628c01251f4add95..71b8118593b60e8d4f47c39092e463377989b13a 100644 (file)
@@ -109,6 +109,11 @@ def func(parser, options, args):
     # 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/',