Slightly modify the "publish" command description
[stgit] / stgit / commands / publish.py
index cfd63a0..391a6a2 100644 (file)
@@ -23,7 +23,7 @@ from stgit.lib import git, stack
 from stgit.out import out
 from stgit import utils
 
-help = 'Publish the stack changes to a merge-friendly head'
+help = 'Push the stack changes to a merge-friendly branch'
 kind = 'stack'
 usage = ['[options] [branch]']
 description = """
@@ -109,8 +109,13 @@ 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),
+        message = 'Merge %s into %s' % (repository.describe(stack.base).strip(),
                                         utils.strip_prefix('refs/heads/',
                                                            public_ref))
         public_head = __create_commit(repository, stack.head.data.tree,