3 # Copyright (c) Josef "Jeff" Sipek, 2007-2013
6 DO_NOT_CHECK_BRANCH_EXISTENCE
=1
8 USAGE
="[-n] [-s] [--in-reply-to <msgid>] [--git] [--subject-prefix <prefix>] [<hash> | <since>..[<until>] | ..<until>]"
9 if [ -z "$GUILT_VERSION" ]; then
10 echo "Invoking `basename "$0"` directly is no longer supported." >&2
16 TMP_FILE
=`get_tmp_file file`
18 while [ $# -gt 0 ]; do
44 r
=`munge_hash_range "$1"`
49 # display the list of commits to be sent as patches
50 git log
--no-decorate --pretty=oneline
"$r" | cut
-c 1-8,41- |
$pager
52 _disp
"Are these what you want to send? [Y/n] "
54 if [ "$n" = "n" ] ||
[ "$n" = "N" ]; then
58 dir
=`get_tmp_file patchbomb -d`
59 disp
"Using '$dir' as temporary directory"
61 # more than one patch?
62 if [ `git rev-list "$r" | wc -l` -gt 1 ]; then
63 format_opts
="-n" # include "n/m" in the subject
64 send_opts
="--no-chain-reply-to --compose" # compose
67 [ ! -z "$gitdiff" ] && format_opts
="$format_opts -C -M --find-copies-harder"
68 [ -z "$no_sign_off" ] && format_opts
="$format_opts -s"
70 if [ -z "$subject_prefix" ]; then
71 git format-patch
$format_opts -o $dir "$r"
73 git format-patch
$format_opts --subject-prefix="$subject_prefix" -o $dir "$r"
76 # get the to/cc addresses
77 _disp
"Enter all the To: email addresses (separated by space): "
79 _disp
"Enter all the Cc: email addresses (separated by space): "
82 # convert list of email addresses to command line options
85 to_opts
="$to_opts --to $rt"
88 to_opts
="$to_opts --cc $rc"
91 opts
="$send_opts $to_opts"
93 # last possible point to abort!
94 _disp
"Proceed with patchbomb (this is the last chance to abort)? [y/N] "
96 if [ "$n" != "y" ] && [ "$n" != "Y" ]; then
100 # ...and off they go.
102 if [ ! -z "$do_not_send" ]; then
103 disp
"-n passed: not sending, command that would be executed:" >&2
104 cmd
="echo git send-email"
107 if [ -z "$reply_to" ]; then
110 $cmd --in-reply-to "$reply_to" $opts $dir
114 _disp
"Delete temporary directory? [Y/n] "
117 [ "$n" = "n" ] ||
[ "$n" = "N" ] && exit 0