Re: [PATCH] xfsprogs: simplify patch naming in libxfs-commit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> ---
> 
> 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@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs
> 

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs



[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux