Skip to content

Commit

Permalink
Do not over-quote the -f envelopesender value.
Browse files Browse the repository at this point in the history
Without this, the value passed to sendmail would have an extra set of
single quotes.  At least exim's sendmail emulation would object to that:

    exim: bad -f address "'list-addr@example.org'": malformed address: ' \
      may not follow 'list-addr@example.org
    error: hooks/post-receive exited with error code 1

Signed-off-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jim Meyering authored and Junio C Hamano committed Sep 25, 2007
1 parent e883932 commit d1637a0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions contrib/hooks/post-receive-email
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,15 @@ generate_delete_general_email()
echo $LOGEND
}

send_mail()
{
if [ -n "$envelopesender" ]; then
/usr/sbin/sendmail -t -f "$envelopesender"
else
/usr/sbin/sendmail -t
fi
}

# ---------------------------- main()

# --- Constants
Expand Down Expand Up @@ -607,13 +616,8 @@ if [ -n "$1" -a -n "$2" -a -n "$3" ]; then
# resend an email; they could redirect the output to sendmail themselves
PAGER= generate_email $2 $3 $1
else
if [ -n "$envelopesender" ]; then
envelopesender="-f '$envelopesender'"
fi

while read oldrev newrev refname
do
generate_email $oldrev $newrev $refname |
/usr/sbin/sendmail -t $envelopesender
generate_email $oldrev $newrev $refname | send_mail
done
fi

0 comments on commit d1637a0

Please sign in to comment.