create-pull-request: set subject automatically for cover latter

Set cover letter's subject automatically as the patch's subject when
there is only one patch.

[YOCTO #9410]

(From OE-Core rev: 162b80f8a4670befaf6ffd2c178671cf7370b767)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Robert Yang 2016-04-18 19:16:03 -07:00 committed by Richard Purdie
parent 1d7228c565
commit 9ddb513a7f
1 changed files with 7 additions and 1 deletions

View File

@ -261,7 +261,13 @@ if [ -n "$BODY" ]; then
sed -i "/BLURB HERE/ d" "$CL"
fi
# If the user specified a subject, replace the SUBJECT token with it.
# Set subject automatically if there is only one patch
patch_cnt=`git log --pretty=oneline ${RELATIVE_TO}..${L_BRANCH} | wc -l`
if [ -z "$SUBJECT" -a $patch_cnt -eq 1 ]; then
SUBJECT="`git log --format=%s ${RELATIVE_TO}..${L_BRANCH}`"
fi
# Replace the SUBJECT token with it.
if [ -n "$SUBJECT" ]; then
sed -i -e "s/\*\*\* SUBJECT HERE \*\*\*/$SUBJECT/" "$CL"
fi