]> code.ossystems Code Review - openembedded-core.git/commitdiff
create-pull-request: set subject automatically for cover latter
authorRobert Yang <liezhi.yang@windriver.com>
Tue, 19 Apr 2016 02:16:03 +0000 (19:16 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 4 Aug 2016 14:05:48 +0000 (15:05 +0100)
Set cover letter's subject automatically as the patch's subject when
there is only one patch.

[YOCTO #9410]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/create-pull-request

index 9ea28a1652a81322b87144b9a59898e5df261d1d..3f30cf1965d74c18ba26d5106206db1e0f558aa9 100755 (executable)
@@ -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