Skip to content

Commit d1637a0

Browse files
meyeringgitster
authored andcommitted
Do not over-quote the -f envelopesender value.
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 "'[email protected]'": malformed address: ' \ may not follow '[email protected] error: hooks/post-receive exited with error code 1 Signed-off-by: Jim Meyering <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e883932 commit d1637a0

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

contrib/hooks/post-receive-email

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,15 @@ generate_delete_general_email()
571571
echo $LOGEND
572572
}
573573

574+
send_mail()
575+
{
576+
if [ -n "$envelopesender" ]; then
577+
/usr/sbin/sendmail -t -f "$envelopesender"
578+
else
579+
/usr/sbin/sendmail -t
580+
fi
581+
}
582+
574583
# ---------------------------- main()
575584

576585
# --- Constants
@@ -607,13 +616,8 @@ if [ -n "$1" -a -n "$2" -a -n "$3" ]; then
607616
# resend an email; they could redirect the output to sendmail themselves
608617
PAGER= generate_email $2 $3 $1
609618
else
610-
if [ -n "$envelopesender" ]; then
611-
envelopesender="-f '$envelopesender'"
612-
fi
613-
614619
while read oldrev newrev refname
615620
do
616-
generate_email $oldrev $newrev $refname |
617-
/usr/sbin/sendmail -t $envelopesender
621+
generate_email $oldrev $newrev $refname | send_mail
618622
done
619623
fi

0 commit comments

Comments
 (0)