[pnfs] empty patches
Benny Halevy
bhalevy at panasas.com
Thu Apr 10 11:16:46 EDT 2008
On Apr. 10, 2008, 17:14 +0300, Fredric Isaman <iisaman at citi.umich.edu> wrote:
> Sorry about the extra empty patch added to the end of each
> sequence using a duplicated subject line. That's the result of using
> "send-email *" instead of "send-email *.patch".
>
> Fred
>
> _______________________________________________
> pNFS mailing list
> pNFS at linux-nfs.org
> http://linux-nfs.org/cgi-bin/mailman/listinfo/pnfs
Try the following script next time :)
It will at least prompt you before sending each email
unless you run it in auto mode. In which case it will
wait for your mailq to empty before sending each patch so the
arrive in order.
Signed-off-by: Benny Halevy <bhalevy at panasas.com>
diff -Nurp -N /dev/null /usr/bin/git-send-patch
--- /dev/null 2008-03-31 15:47:35.416331458 +0300
+++ /usr/bin/git-send-patch 2008-03-28 12:33:20.000000000 +0300
@@ -0,0 +1,78 @@
+#!/bin/bash
+
+usage () {
+ echo "Usage: `basename $0` [-a] [-f from] [-i in-reply-to] [git-send-email options ...] [-t to] patch ..." 1>&2
+ exit 1
+}
+
+from=""
+to=""
+opts=""
+id=""
+auto=0
+while [[ "$1" == -* ]]; do
+ case "$1" in
+ (-h|--help)
+ usage;;
+ -a)
+ auto=1;;
+ -f)
+ from="$2"; shift;;
+ -t)
+ to="$to $2"; shift;;
+ -i)
+ id="$2"
+ opts="$opts --no-chain-reply-to --in-reply-to \"$id\""
+ shift;;
+ *)
+ opts="$opts $1 \"$2\""
+ shift;;
+ esac
+ shift
+done
+
+if [ $# = 0 ]; then
+ usage
+fi
+
+if [ "$to" = "" ]; then
+ read -p "To: " to
+ if [ "$to" = "" ]; then
+ usage
+ fi
+fi
+
+if [ "$from" = "" ]; then
+ from=`ypcat passwd | awk -F: '
+ $1 == ENVIRON["USER"] {
+ printf("%s <%s at panasas.com>\n", $5, $1);
+ }'`
+fi
+for i in "$to"; do
+ opts="--to \"$i\" $opts"
+done
+opts="--from \"$from\" $opts"
+
+for i; do
+ cmd="git send-email $opts \"$i\""
+ echo $cmd
+ if [ $auto = 0 ]; then
+ read -s -n 1 -p "press any key to send (^C to abort)..."
+ echo
+ else
+ f=1
+ while true; do
+ n=`sudo mailq | awk '/Total requests: / {print $3}'`
+ if [ "$n" == 0 ]; then
+ break;
+ else
+ if [ $f = 0 ]; then
+ echo $0: waiting for $n messages in mailq 1>&2
+ fi
+ sleep 10
+ fi
+ f=0
+ done
+ fi
+ eval $cmd
+done
More information about the pNFS
mailing list