[OE-core] [PATCH 3/3] create-pull-request: set subject automatically for cover latter

Robert Yang liezhi.yang at windriver.com
Tue Apr 19 02:45:32 UTC 2016


Set cover letter's subject automatically as the patch's subject when
there is only one patch and "-s" not used.

[YOCTO #9410]

Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
---
 scripts/create-pull-request | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/scripts/create-pull-request b/scripts/create-pull-request
index 613e7ae..660f3cf 100755
--- a/scripts/create-pull-request
+++ b/scripts/create-pull-request
@@ -251,7 +251,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
-- 
2.7.4




More information about the Openembedded-core mailing list