获取git mail的每个git提交下的文件

获取git mail的每个git提交下的文件,git,email,Git,Email,我正在尝试设置一个邮件客户端,每当git推送到中央回购时,它都会触发一封电子邮件。因此,我从中复制了脚本 这是我收到的推送邮件 The project "My-Engineering": The branch, master has been updated via e6693c90f2296a8df3bfcb13735cde069aababcd (commit) via 4e7e0176605a22b698e80f46b774abb1e721abcd

我正在尝试设置一个邮件客户端,每当git推送到中央回购时,它都会触发一封电子邮件。因此,我从中复制了脚本

这是我收到的推送邮件

 The project "My-Engineering":

    The branch, master has been updated
       via  e6693c90f2296a8df3bfcb13735cde069aababcd (commit)
       via  4e7e0176605a22b698e80f46b774abb1e721abcd (commit)
      from  c14285610f07ea8cd6613f5205d10a6fbbdbabcd (commit)


- Log -----------------------------------------------------------------
commit e6693c90f2296a8df3bfcb13735cde069aababcd
Author: NewBie<xxx@abc.com>
Date:   Tue Apr 14 18:27:10 2015 +0530

hack.txt commit

commit 4e7e0176605a22b698e80f46b774abb1e721abcd
Author: NewBie<xxx@abc.com>
Date:   Tue Apr 14 18:26:47 2015 +0530

help txt modified

-----------------------------------------------------------------------

Summary of changes:
help.txt  | 1 +
hack.txt | 1 +
2 files changed, 2 insertions(+)

--
My-Engineering
因此,我通过以下方式修改了上面链接中脚本中的代码:-

show_new_revisions()
{

    if [ "$change_type" = create ]
    then
        # Show all revisions exclusive to this (new) branch.
        revspec=$newrev
    else
        # Branch update; show revisions not part of $oldrev.
        revspec=$oldrev..$newrev
    fi

    other_branches=$(git for-each-ref --format='%(refname)' refs/heads/ |
    grep -F -v $refname)
    git rev-parse --not $other_branches |

    msg_count=0;
    git rev-list --pretty --stdin $revspec |
    while read onerev
    do
        # eval $(printf "$custom_showrev" onerev: $onerev)
        (( msg_count+=1 ))
        echo $msg_count
        if [ $msg_count == 5 ]
        then
            emailsubject="$onerev"
            echo "Files affected"
            git diff $oldrev..$newrev --name-status    #### Added this command 
            echo "$emailsubject" > "$emailsubject_tmp_file"
        fi
        echo "$onerev"
    done
}
但是,
git diff$oldrev..$newrev--name status
只有在推送下有两次提交时才能正常工作。如果我有2次以上的提交,那么对于每次提交,我都需要执行
git diff$current\u rev--name status
。 为此,我需要添加这段代码

 for rev in $(git rev-list $newrev..$oldrev)
    do
        echo "    $rev "
    done
但我无法添加它并使其工作。
谁能帮我解决这个问题。或者,建议是否有其他更好的方法,仅在具有多个提交的推送中的特定提交中显示更改

 show_new_revisions()
    {
        # This shows all log entries that are not already covered by
        # another ref - i.e. commits that are now accessible from this
        # ref that were previously not accessible
        # (see generate_update_branch_email for the explanation of this
        # command)

        # Revision range passed to rev-list differs for new vs. updated
        # branches.
        if [ "$change_type" = create ]
        then
            # Show all revisions exclusive to this (new) branch.
            revspec=$newrev
        else
            # Branch update; show revisions not part of $oldrev.
            revspec=$oldrev..$newrev
        fi

        for i in $(git rev-list $oldrev..$newrev)
        do
            echo " "
            git show --name-status $i
            echo " "
        done
    }
 show_new_revisions()
    {
        # This shows all log entries that are not already covered by
        # another ref - i.e. commits that are now accessible from this
        # ref that were previously not accessible
        # (see generate_update_branch_email for the explanation of this
        # command)

        # Revision range passed to rev-list differs for new vs. updated
        # branches.
        if [ "$change_type" = create ]
        then
            # Show all revisions exclusive to this (new) branch.
            revspec=$newrev
        else
            # Branch update; show revisions not part of $oldrev.
            revspec=$oldrev..$newrev
        fi

        for i in $(git rev-list $oldrev..$newrev)
        do
            echo " "
            git show --name-status $i
            echo " "
        done
    }