From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay.sgi.com (relay2.corp.sgi.com [137.38.102.29]) by oss.sgi.com (Postfix) with ESMTP id CA3927F5A for ; Thu, 2 Jul 2015 22:40:42 -0500 (CDT) Received: from cuda.sgi.com (cuda1.sgi.com [192.48.157.11]) by relay2.corp.sgi.com (Postfix) with ESMTP id A3BAE304048 for ; Thu, 2 Jul 2015 20:40:42 -0700 (PDT) Received: from sandeen.net (sandeen.net [63.231.237.45]) by cuda.sgi.com with ESMTP id z4SD4x7zufMSe17u for ; Thu, 02 Jul 2015 20:40:40 -0700 (PDT) Received: from liberator.sandeen.net (liberator.sandeen.net [10.0.0.4]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by sandeen.net (Postfix) with ESMTPSA id 940D260D2E83 for ; Thu, 2 Jul 2015 22:40:39 -0500 (CDT) Message-ID: <55960437.1090309@sandeen.net> Date: Thu, 02 Jul 2015 22:40:39 -0500 From: Eric Sandeen MIME-Version: 1.0 Subject: Re: [PATCH] xfsprogs: simplify patch naming in libxfs-commit References: <55960400.4060106@sandeen.net> In-Reply-To: <55960400.4060106@sandeen.net> List-Id: XFS Filesystem from SGI List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: xfs-bounces@oss.sgi.com Sender: xfs-bounces@oss.sgi.com To: xfs-oss Gah, tidy up the subject to "libxfs-apply" if you commit it please :) -Eric On 7/2/15 10:39 PM, Eric Sandeen wrote: > Git already knows how to create a patch name from a commit, > no need to re-invent it with cats walking on keyboards, > entering obfuscated sed contests. ;) > > Signed-off-by: Eric Sandeen > --- > > Untested, TBH - at least as part of the script. > > The git command works on its own, given a commit id. > > diff --git a/tools/libxfs-apply b/tools/libxfs-apply > index 4a8c8a6..09e8f40 100755 > --- a/tools/libxfs-apply > +++ b/tools/libxfs-apply > @@ -223,26 +223,6 @@ apply_patch() > rm -f $_new_patch > } > > -# name a guilt patch. Code is lifted from guilt import-commit. > -name_patch() > -{ > - s=`git log --no-decorate --pretty=oneline -1 $1 | cut -c 42-` > - > - # Try to convert the first line of the commit message to a > - # valid patch name. > - fname=`printf %s "$s" | \ > - sed -e "s/&/and/g" -e "s/[ :]/_/g" -e "s,[/\\],-,g" \ > - -e "s/['\\[{}]//g" -e 's/]//g' -e 's/\*/-/g' \ > - -e 's/\?/-/g' -e 's/\.\.\.*/./g' -e 's/^\.//' \ > - -e 's/\.patch$//' -e 's/\.$//' | tr A-Z a-z` > - > - # Try harder to make it a legal commit name by > - # removing all but a few safe characters. > - fname=`echo $fname|tr -d -c _a-zA-Z0-9---/\\n` > - > - echo $fname > -} > - > # single patch is easy. > if [ -z "$COMMIT_ID" ]; then > apply_patch $PATCH > @@ -274,7 +254,7 @@ for commit in $commit_list; do > # switch to source repo and pull commit into a patch file > pushd $REPO > /dev/null > git show $commit > $PATCH || usage "Bad source commit ID!" > - patch_name=`name_patch $commit` > + patch_name=`git log --format=format:"%f.patch" -1 $commit` > popd > /dev/null > > apply_patch $PATCH $patch_name $commit > > _______________________________________________ > xfs mailing list > xfs@oss.sgi.com > http://oss.sgi.com/mailman/listinfo/xfs > _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs