Skip to content

Commit 09a3730

Browse files
committed
Merge branch 'jn/post-receive-utf8'
Update post-receive-email script to make sure the message contents and pathnames are encoded consistently in UTF-8. * jn/post-receive-utf8: hooks/post-receive-email: set declared encoding to utf-8 hooks/post-receive-email: force log messages in UTF-8 hooks/post-receive-email: use plumbing instead of git log/show
2 parents 6026f68 + 53a7296 commit 09a3730

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

contrib/hooks/post-receive-email

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,9 @@ generate_email_header()
242242
cat <<-EOF
243243
To: $recipients
244244
Subject: ${emailprefix}$projectdesc $refname_type $short_refname ${change_type}d. $describe
245+
MIME-Version: 1.0
246+
Content-Type: text/plain; charset=utf-8
247+
Content-Transfer-Encoding: 8bit
245248
X-Git-Refname: $refname
246249
X-Git-Reftype: $refname_type
247250
X-Git-Oldrev: $oldrev
@@ -471,7 +474,7 @@ generate_delete_branch_email()
471474
echo " was $oldrev"
472475
echo ""
473476
echo $LOGBEGIN
474-
git show -s --pretty=oneline $oldrev
477+
git diff-tree -s --always --encoding=UTF-8 --pretty=oneline $oldrev
475478
echo $LOGEND
476479
}
477480

@@ -547,11 +550,11 @@ generate_atag_email()
547550
# performed on them
548551
if [ -n "$prevtag" ]; then
549552
# Show changes since the previous release
550-
git rev-list --pretty=short "$prevtag..$newrev" | git shortlog
553+
git shortlog "$prevtag..$newrev"
551554
else
552555
# No previous tag, show all the changes since time
553556
# began
554-
git rev-list --pretty=short $newrev | git shortlog
557+
git shortlog $newrev
555558
fi
556559
;;
557560
*)
@@ -571,7 +574,7 @@ generate_delete_atag_email()
571574
echo " was $oldrev"
572575
echo ""
573576
echo $LOGBEGIN
574-
git show -s --pretty=oneline $oldrev
577+
git diff-tree -s --always --encoding=UTF-8 --pretty=oneline $oldrev
575578
echo $LOGEND
576579
}
577580

@@ -617,7 +620,7 @@ generate_general_email()
617620
echo ""
618621
if [ "$newrev_type" = "commit" ]; then
619622
echo $LOGBEGIN
620-
git show --no-color --root -s --pretty=medium $newrev
623+
git diff-tree -s --always --encoding=UTF-8 --pretty=medium $newrev
621624
echo $LOGEND
622625
else
623626
# What can we do here? The tag marks an object that is not
@@ -636,7 +639,7 @@ generate_delete_general_email()
636639
echo " was $oldrev"
637640
echo ""
638641
echo $LOGBEGIN
639-
git show -s --pretty=oneline $oldrev
642+
git diff-tree -s --always --encoding=UTF-8 --pretty=oneline $oldrev
640643
echo $LOGEND
641644
}
642645

0 commit comments

Comments
 (0)