All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: xfs-oss <xfs@oss.sgi.com>
Subject: Re: [PATCH] xfsprogs: simplify patch naming in libxfs-commit
Date: Thu, 02 Jul 2015 22:40:39 -0500	[thread overview]
Message-ID: <55960437.1090309@sandeen.net> (raw)
In-Reply-To: <55960400.4060106@sandeen.net>

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 <sandeen@redhat.com>
> ---
> 
> 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

      reply	other threads:[~2015-07-03  3:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-03  3:39 [PATCH] xfsprogs: simplify patch naming in libxfs-commit Eric Sandeen
2015-07-03  3:40 ` Eric Sandeen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55960437.1090309@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.