diff --git a/zerver/views/webhooks.py b/zerver/views/webhooks.py index ec68639aa3..d565cf64c6 100644 --- a/zerver/views/webhooks.py +++ b/zerver/views/webhooks.py @@ -116,7 +116,8 @@ def api_github_v2(user_profile, event, payload, branches, default_stream, commit payload['before'], payload['after'], payload['compare'], payload['pusher']['name'], - forced=payload['forced']) + forced=payload['forced'], + created=payload['created']) elif event == 'commit_comment': comment = payload['comment'] subject = "%s: commit %s" % (topic_focus, comment['commit_id']) @@ -255,14 +256,15 @@ def build_commit_list_content(commits, branch, compare_url, pusher): return content -def build_message_from_gitlog(user_profile, name, ref, commits, before, after, url, pusher, forced=None): +def build_message_from_gitlog(user_profile, name, ref, commits, before, after, url, pusher, forced=None, created=None): short_ref = re.sub(r'^refs/heads/', '', ref) subject = name if re.match(r'^0+$', after): content = "%s deleted branch %s" % (pusher, short_ref) - elif forced or (forced is None and len(commits) == 0): + # 'created' and 'forced' are github flags; the second check is for beanstalk + elif (forced and not created) or (forced is None and len(commits) == 0): content = ("%s [force pushed](%s) to branch %s. Head is now %s" % (pusher, url,