Imported Upstream version 2.25.0
[platform/upstream/git.git] / contrib / hooks / post-receive-email
index 01af9df..ff565eb 100755 (executable)
@@ -2,10 +2,19 @@
 #
 # Copyright (c) 2007 Andy Parkins
 #
-# An example hook script to mail out commit update information.  This hook
-# sends emails listing new revisions to the repository introduced by the
-# change being reported.  The rule is that (for branch updates) each commit
-# will appear on one email and one email only.
+# An example hook script to mail out commit update information.
+#
+# NOTE: This script is no longer under active development.  There
+# is another script, git-multimail, which is more capable and
+# configurable and is largely backwards-compatible with this script;
+# please see "contrib/hooks/multimail/".  For instructions on how to
+# migrate from post-receive-email to git-multimail, please see
+# "README.migrate-from-post-receive-email" in that directory.
+#
+# This hook sends emails listing new revisions to the repository
+# introduced by the change being reported.  The rule is that (for
+# branch updates) each commit will appear on one email and one email
+# only.
 #
 # This hook is stored in the contrib/hooks directory.  Your distribution
 # will have put this somewhere standard.  You should make this script
@@ -13,7 +22,6 @@
 # For example, on debian the hook is stored in
 # /usr/share/git-core/contrib/hooks/post-receive-email:
 #
-#  chmod a+x post-receive-email
 #  cd /path/to/your/repository.git
 #  ln -sf /usr/share/git-core/contrib/hooks/post-receive-email hooks/post-receive
 #
@@ -233,10 +241,14 @@ generate_email_header()
        cat <<-EOF
        To: $recipients
        Subject: ${emailprefix}$projectdesc $refname_type $short_refname ${change_type}d. $describe
+       MIME-Version: 1.0
+       Content-Type: text/plain; charset=utf-8
+       Content-Transfer-Encoding: 8bit
        X-Git-Refname: $refname
        X-Git-Reftype: $refname_type
        X-Git-Oldrev: $oldrev
        X-Git-Newrev: $newrev
+       Auto-Submitted: auto-generated
 
        This is an automated email from the git hooks/post-receive script. It was
        generated because a ref change was pushed to the repository containing
@@ -317,7 +329,7 @@ generate_update_branch_email()
        #
        #  git rev-parse --not --all | grep -v $(git rev-parse $refname)
        #
-       # Get's us to something pretty safe (apart from the small time
+       # Gets us to something pretty safe (apart from the small time
        # between refname being read, and git rev-parse running - for that,
        # I give up)
        #
@@ -403,7 +415,7 @@ generate_update_branch_email()
                        echo "            \\"
                        echo "             O -- O -- O ($oldrev)"
                        echo ""
-                       echo "The removed revisions are not necessarilly gone - if another reference"
+                       echo "The removed revisions are not necessarily gone - if another reference"
                        echo "still refers to them they will stay in the repository."
                        rewind_only=1
                else
@@ -461,7 +473,7 @@ generate_delete_branch_email()
        echo "       was  $oldrev"
        echo ""
        echo $LOGBEGIN
-       git show -s --pretty=oneline $oldrev
+       git diff-tree -s --always --encoding=UTF-8 --pretty=oneline $oldrev
        echo $LOGEND
 }
 
@@ -537,11 +549,11 @@ generate_atag_email()
                # performed on them
                if [ -n "$prevtag" ]; then
                        # Show changes since the previous release
-                       git rev-list --pretty=short "$prevtag..$newrev" | git shortlog
+                       git shortlog "$prevtag..$newrev"
                else
                        # No previous tag, show all the changes since time
                        # began
-                       git rev-list --pretty=short $newrev | git shortlog
+                       git shortlog $newrev
                fi
                ;;
        *)
@@ -561,7 +573,7 @@ generate_delete_atag_email()
        echo "       was  $oldrev"
        echo ""
        echo $LOGBEGIN
-       git show -s --pretty=oneline $oldrev
+       git diff-tree -s --always --encoding=UTF-8 --pretty=oneline $oldrev
        echo $LOGEND
 }
 
@@ -607,7 +619,7 @@ generate_general_email()
        echo ""
        if [ "$newrev_type" = "commit" ]; then
                echo $LOGBEGIN
-               git show --no-color --root -s --pretty=medium $newrev
+               git diff-tree -s --always --encoding=UTF-8 --pretty=medium $newrev
                echo $LOGEND
        else
                # What can we do here?  The tag marks an object that is not
@@ -626,7 +638,7 @@ generate_delete_general_email()
        echo "       was  $oldrev"
        echo ""
        echo $LOGBEGIN
-       git show -s --pretty=oneline $oldrev
+       git diff-tree -s --always --encoding=UTF-8 --pretty=oneline $oldrev
        echo $LOGEND
 }