diff options
author | Catalin Marinas <catalin.marinas@gmail.com> | 2009-09-30 21:52:35 +0100 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@gmail.com> | 2009-09-30 21:52:35 +0100 |
commit | 6c052b023837579aab6dcb030ffdcea4a88e37ed (patch) | |
tree | 21b3102b2df61523088ba62dba63538a680ddcbb | |
parent | 63bffebacfdc5a87275e53a51b3263c9bddd93f7 (diff) | |
download | stgit-6c052b023837579aab6dcb030ffdcea4a88e37ed.tar.gz |
Fast-forward the published head when possible
This is to avoid a merge commit when fast-forwarding is possible.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
-rw-r--r-- | stgit/commands/publish.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/stgit/commands/publish.py b/stgit/commands/publish.py index d829916..71b8118 100644 --- a/stgit/commands/publish.py +++ b/stgit/commands/publish.py @@ -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/', |