From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH] devtools: make commits with stable tag outstanding Date: Fri, 10 Mar 2017 12:13:28 +0100 Message-ID: <5048683.EcVWt1ukKe@xps13> References: <1487818172-12910-1-git-send-email-yuanhan.liu@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org To: Yuanhan Liu Return-path: Received: from mail-wr0-f179.google.com (mail-wr0-f179.google.com [209.85.128.179]) by dpdk.org (Postfix) with ESMTP id 5B5DF2C49 for ; Fri, 10 Mar 2017 12:13:30 +0100 (CET) Received: by mail-wr0-f179.google.com with SMTP id l37so62790740wrc.1 for ; Fri, 10 Mar 2017 03:13:30 -0800 (PST) In-Reply-To: <1487818172-12910-1-git-send-email-yuanhan.liu@linux.intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 2017-02-23 10:49, Yuanhan Liu: > So that, as a stable maintainer while picking commits to a stable release, > I could pay less attention to those have it and pay more attention to those > don't have it. Good idea > + stable="-" > + git show $id | grep -qi 'Cc: .*stable@dpdk.org' && stable="S" Instead of git show, it is preferrable to get only the message content: git log --format='%b' -1 $id The regex may miss a Cc: without space, and may match a Cc in the middle of a sentence. I suggest this one: grep -qi '^Cc: *stable@dpdk.org' The script is written in the style "set -e" so it must be avoided to have a "false" statement not catched. It can be done in 2 ways: 1/ git log --format='%b' -1 $id | grep -qi '^Cc: *stable@dpdk.org' && stable='S' || stable='-' 2/ if git log --format='%b' -1 $id | grep -qi '^Cc: *stable@dpdk.org' ; then stable='S' else stable='-' endif We can also move it in a function in order to keep only the logic in the "main" block: stable=$(stable_tag $id) # print a marker for stable tag presence stable_tag () # { if git log --format='%b' -1 $id | grep -qi '^Cc: *stable@dpdk.org' ; then echo 'S' else echo '-' endif }