From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [PATCH] devtools: check commit log fixes syntax Date: Tue, 29 Jan 2019 18:07:51 +0000 Message-ID: <6dfa0d84-3734-51be-a4a2-298c0f1b9b7c@intel.com> References: <20190129153052.38634-1-ferruh.yigit@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: Thomas Monjalon , dev@dpdk.org, Qi Zhang To: David Marchand Return-path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id E166A1B131 for ; Tue, 29 Jan 2019 19:07:53 +0100 (CET) In-Reply-To: Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 1/29/2019 5:34 PM, David Marchand wrote: > On Tue, Jan 29, 2019 at 4:31 PM Ferruh Yigit wrote: > >> Fixes line commit id length defined as 12 in fixline alias: >> fixline = log -1 --abbrev=12 --format='Fixes: %h (\"%s\")%nCc: %ae' >> >> Check if the Fixes line commit id length matches the defined value. >> > > Can't git decide to report a longer string in case of collisions of > abbreviated id ? > > Tried this for 2 characters, and git forcefully reported 5 chars: > $ git log -1 --abbrev=2 origin/master --format='Fixes: %h (\"%s\")' > Fixes: a2f9c (\"version: 19.02-rc4\") > > I did not find any collisions with 12 characters abbreviated commitid, but > I am not sure enforcing the check on exactly 12 characters is a good idea > in the long run. Yes git can report a longer string in case of collisions, but I don't expect to have one with 12 characters. This is mainly for some cases either people use full 40 chars or small ones. Indeed in background I am (and most probably Thomas too) fixing them while merging, I thought it is better idea to integrate that into script so that developers can be aware of the syntax issue and fix it before sending. > > >> Signed-off-by: Ferruh Yigit >> --- >> Cc: Qi Zhang >> --- >> devtools/check-git-log.sh | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/devtools/check-git-log.sh b/devtools/check-git-log.sh >> index d39064f9d..f4d6c1fba 100755 >> --- a/devtools/check-git-log.sh >> +++ b/devtools/check-git-log.sh >> @@ -177,6 +177,11 @@ bad=$(for fixtag in $fixtags ; do >> done | sed 's,^,\t,') >> [ -z "$bad" ] || printf "Wrong 'Fixes' reference:\n$bad\n" >> >> +bad=$(for fixtag in $fixtags ; do >> > + echo $fixtag | awk '{print $2}' | awk 'length != 12 {print}' >> > +done) >> > > Not an awk expert (this could be done in pure shell, but this is a > different story :-p), but I would see something like: > > for fixtag in $fixtags; do > echo $fixtag | awk 'length($2) < 12 { print $2 }'; > done Yes, looks better, I will update the script. And no specific preference on shell or awk implementation, there is no performance concern in this script and awk already used by it, I am good as long as it is functional.