3 # Copyright (c) Josef "Jeff" Sipek, 2007
6 DO_NOT_CHECK_BRANCH_EXISTENCE
=1
8 USAGE
="[-n] [--in-reply-to <msgid>] [<hash> | <since>..[<until>] | ..<until>]"
11 TMP_FILE
=`get_tmp_file file`
13 while [ $# -gt 0 ]; do
29 r
=`munge_hash_range "$1"`
34 # display the list of commits to be sent as patches
35 git log
--pretty=oneline
"$r" | cut
-c 1-8,41- |
$pager
37 _disp
"Are these what you want to send? [Y/n] "
39 if [ "$n" = "n" ] ||
[ "$n" = "N" ]; then
43 dir
=/tmp
/patches-
$RANDOM/
45 die
"Conspiracy uncovered: Temporary dir '$dir' already exists"
47 disp
"Using '$dir' as temporary directory"
49 git format-patch
-o $dir -n -s "$r"
51 # get the to/cc addresses
52 _disp
"Enter all the To: email addresses (separated by space): "
54 _disp
"Enter all the Cc: email addresses (separated by space): "
57 # convert list of email addresses to command line options
60 to_opts
="$to_opts --to $rt"
63 to_opts
="$to_opts --cc $rc"
69 if [ `git rev-list "$r" | wc -l` -gt 1 ]; then
70 opts
="$opts --no-chain-reply-to --compose"
74 # last possible point to abort!
75 _disp
"Proceed with patchbomb (this is the last chance to abort)? [y/N] "
77 if [ "$n" != "y" ] && [ "$n" != "Y" ]; then
83 if [ ! -z "$do_not_send" ]; then
84 disp
"-n passed: not sending, command that would be executed:" >&2
85 cmd
="echo git send-email"
88 if [ -z "$reply_to" ]; then
91 $cmd --in-reply-to "$reply_to" $opts $dir
95 _disp
"Delete temporary directory? [Y/n] "
98 [ "$n" = "n" ] ||
[ "$n" = "N" ] && exit 0