Skip to content

Commit

Permalink
SPARK-1073 Keep GitHub pull request title as commit summary
Browse files Browse the repository at this point in the history
The first line of a git commit message is the line that's used with many git
tools as the most concise textual description of that message.  The most
common use that I see is in the short log, which is a one line per commit
log of recent commits.

This commit moves the line

  Merge pull request #%s from %s.

Lower into the message to reserve the first line of the resulting commit for
the much more important pull request title.

http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html

Author: Andrew Ash <[email protected]>

Closes apache#574 from ash211/gh-pr-merge-title and squashes the following commits:

b240823 [Andrew Ash] More merge_message improvements
d2986db [Andrew Ash] Keep GitHub pull request title as commit summary
  • Loading branch information
ash211 authored and pwendell committed Feb 13, 2014
1 parent 7fe7a55 commit 6ee0ad8
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions dev/merge_spark_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,20 @@ def merge_pr(pr_num, target_ref):
commits = run_cmd(['git', 'log', 'HEAD..%s' % pr_branch_name,
'--pretty=format:%h [%an] %s']).split("\n\n")

merge_message = "Merge pull request #%s from %s.\n\n%s\n\n%s" % (
pr_num, pr_repo_desc, title, body)
merge_message_parts = merge_message.split("\n\n")
merge_message_flags = []

for p in merge_message_parts:
merge_message_flags = merge_message_flags + ["-m", p]
for p in [title, body]:
merge_message_flags += ["-m", p]

authors = "\n".join(["Author: %s" % a for a in distinct_authors])
merge_message_flags = merge_message_flags + ["-m", authors]
merge_message_flags = merge_message_flags + [
"-m", "Closes #%s and squashes the following commits:" % pr_num]

merge_message_flags += ["-m", authors]

# The string "Closes #%s" string is required for GitHub to correctly close the PR
merge_message_flags += ["-m",
"Closes #%s from %s and squashes the following commits:" % (pr_num, pr_repo_desc)]
for c in commits:
merge_message_flags = merge_message_flags + ["-m", c]
merge_message_flags += ["-m", c]

run_cmd(['git', 'commit', '--author="%s"' % primary_author] + merge_message_flags)

Expand Down

0 comments on commit 6ee0ad8

Please sign in to comment.