xfsprogs: simplify patch naming in libxfs-commit
PATCH 1/1 xfsprogs: simplify patch naming in libxfs-commit
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. ;)
---
Untested, TBH - at least as part of the script.
The git command works on its own, given a commit id.
tools/libxfs-apply +1 -21
@@ -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
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Gah, tidy up the subject to "libxfs-apply" if you commit it please :)
-Eric
Quoted 52 lines · Eric Sandeen
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 <[email protected]>---
Untested, TBH - at least as part of the script.
The git command works on its own, given a commit id.
tools/libxfs-apply +1
-21@@ -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
Quoted 5 lines
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs