3 # Copyright (c) Josef "Jeff" Sipek, 2007
6 DO_NOT_CHECK_BRANCH_EXISTENCE
=1
8 USAGE
="[-n] [-s] [--in-reply-to <msgid>] [--git] [--subject-prefix <prefix>] [<hash> | <since>..[<until>] | ..<until>]"
11 TMP_FILE
=`get_tmp_file file`
13 while [ $# -gt 0 ]; do
39 r
=`munge_hash_range "$1"`
44 # display the list of commits to be sent as patches
45 git log
--pretty=oneline
"$r" | cut
-c 1-8,41- |
$pager
47 _disp
"Are these what you want to send? [Y/n] "
49 if [ "$n" = "n" ] ||
[ "$n" = "N" ]; then
53 dir
=`get_tmp_file patchbomb -d`
54 disp
"Using '$dir' as temporary directory"
56 # more than one patch?
57 if [ `git rev-list "$r" | wc -l` -gt 1 ]; then
58 format_opts
="-n" # include "n/m" in the subject
59 send_opts
="--no-chain-reply-to --compose" # compose
62 [ ! -z "$gitdiff" ] && format_opts
="$format_opts -C -M --find-copies-harder"
63 [ -z "$no_sign_off" ] && format_opts
="$format_opts -s"
65 if [ -z "$subject_prefix" ]; then
66 git format-patch
$format_opts -o $dir "$r"
68 git format-patch
$format_opts --subject-prefix="$subject_prefix" -o $dir "$r"
71 # get the to/cc addresses
72 _disp
"Enter all the To: email addresses (separated by space): "
74 _disp
"Enter all the Cc: email addresses (separated by space): "
77 # convert list of email addresses to command line options
80 to_opts
="$to_opts --to $rt"
83 to_opts
="$to_opts --cc $rc"
86 opts
="$send_opts $to_opts"
88 # last possible point to abort!
89 _disp
"Proceed with patchbomb (this is the last chance to abort)? [y/N] "
91 if [ "$n" != "y" ] && [ "$n" != "Y" ]; then
97 if [ ! -z "$do_not_send" ]; then
98 disp
"-n passed: not sending, command that would be executed:" >&2
99 cmd
="echo git send-email"
102 if [ -z "$reply_to" ]; then
105 $cmd --in-reply-to "$reply_to" $opts $dir
109 _disp
"Delete temporary directory? [Y/n] "
112 [ "$n" = "n" ] ||
[ "$n" = "N" ] && exit 0