vim-patch.sh: Include upstream summary in commit message

[ci skip]
This commit is contained in:
James McCoy
2017-12-16 21:42:08 -05:00
parent bfb21f3e01
commit 067bb1e9f4

View File

@ -92,8 +92,11 @@ get_vim_sources() {
}
commit_message() {
printf 'vim-patch:%s\n\n%s\n\n%s' "${vim_version}" \
"${vim_message}" "${vim_commit_url}"
if [[ -n "$vim_tag" ]]; then
printf '%s\n\n%s' "${vim_message}" "${vim_commit_url}"
else
printf 'vim-patch:%s\n\n%s\n\n%s' "$vim_version" "$vim_message" "$vim_commit_url"
fi
}
find_git_remote() {
@ -108,22 +111,23 @@ assign_commit_details() {
vim_tag="v${1}"
vim_commit=$(cd "${VIM_SOURCE_DIR}" \
&& git log -1 --format="%H" "${vim_tag}")
local strip_commit_line=true
local munge_commit_line=true
else
# Interpret parameter as commit hash.
vim_version="${1:0:12}"
vim_tag=
vim_commit=$(cd "${VIM_SOURCE_DIR}" \
&& git log -1 --format="%H" "${vim_version}")
local strip_commit_line=false
local munge_commit_line=false
fi
vim_commit_url="https://github.com/vim/vim/commit/${vim_commit}"
vim_message="$(cd "${VIM_SOURCE_DIR}" \
&& git log -1 --pretty='format:%B' "${vim_commit}" \
| sed -e 's/\(#[0-9]*\)/vim\/vim\1/g')"
if [[ ${strip_commit_line} == "true" ]]; then
if [[ ${munge_commit_line} == "true" ]]; then
# Remove first line of commit message.
vim_message="$(echo "${vim_message}" | sed -e '1d')"
vim_message="$(echo "${vim_message}" | sed -e '1s/^patch /vim-patch:/')"
fi
patch_file="vim-${vim_version}.patch"
}
@ -286,9 +290,10 @@ submit_pr() {
checked_out_branch="$(git rev-parse --abbrev-ref HEAD)"
if [[ "${checked_out_branch}" != ${BRANCH_PREFIX}* ]]; then
echo "✘ Current branch '${checked_out_branch}' doesn't seem to be a vim-patch branch."
exit 1
exit 1
fi
local git_remote
git_remote="$(find_git_remote)"
local pr_body
pr_body="$(git log --grep=vim-patch --reverse --format='#### %s%n%n%b%n' "${git_remote}"/master..HEAD)"