From 61a679d71cd1dc35cf95bb4ded611468a9edad47 Mon Sep 17 00:00:00 2001 From: midipix Date: Tue, 26 Apr 2016 21:37:37 -0400 Subject: project: added CONTRIB and contrib.sh. --- contrib.sh | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100755 contrib.sh (limited to 'contrib.sh') diff --git a/contrib.sh b/contrib.sh new file mode 100755 index 0000000..501b539 --- /dev/null +++ b/contrib.sh @@ -0,0 +1,59 @@ +#!/bin/sh + +# init vars +commit=$1; [ -z "$commit" ] && commit='HEAD' +blank= +bline= +fname= + +# source.patch +git format-patch -1 $commit --stdout > source.patch || exit 2 +cat contrib.msg >> source.patch || exit 2 + +# source.patch without the (noisy) first line +tail -n +2 source.patch > contrib.patch || exit 2 + +# contrib.patch: first blank line +blank=`grep -n ^$ contrib.patch | head -n1` +[ -z "$blank" ] && exit 2 + +bline=`echo $blank | cut -f1 -d':'` +[ -z "$bline" ] && exit 2 + +# use sha256sum of the above for patch file name +fname=`sha256sum contrib.patch | cut -f1 -d' '` || exit 2 +[ -z "$fname" ] && exit 2 + +# prepare for submission, sign the patch +mv contrib.patch $fname.patch || exit 2 +head -n$bline $fname.patch | tail -n +2 > $fname.sig || exit 2 + +[ -z "$PAGER" ] && PAGER='less' +$PAGER $fname.patch || exit 2 +cat contrib.msg || exit 2 + +echo +echo 'press to continue, to abort>' +echo + +read enter + +gpg --armor --detach-sign $fname.patch || exit 2 +cat $fname.patch.asc >> $fname.sig || exit 2 + +# verify +gpg --verify $fname.sig $fname.patch || exit 2 + +# clean up +rm source.patch +rm $fname.patch.asc + +# info +echo +echo "commit $commit was successfully prepared for submission." +echo "$fname.patch: a patch file that can be imported by git-am." +echo "$fname.sig: a gpg signature file of the above patch." +echo + +# all done +exit 0 -- cgit v1.2.3