public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfsprogs: simplify patch naming in libxfs-commit
@ 2015-07-03  3:39 Eric Sandeen
  2015-07-03  3:40 ` Eric Sandeen
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Sandeen @ 2015-07-03  3:39 UTC (permalink / raw)
  To: xfs-oss

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-03  3:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-03  3:39 [PATCH] xfsprogs: simplify patch naming in libxfs-commit Eric Sandeen
2015-07-03  3:40 ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox