3

目前我正在使用 gitolite 来管理我的存储库和用户。每次推送后我都成功设置了通知邮件。命令是

chmod a+x post-receive-email
cd /path/to/your/repository.git
ln -sf /usr/share/doc/git-core/contrib/hooks/post-receive-email hooks/post-receive

通知邮件仅包含更改摘要。我想在该推送中添加每个修改文件的更改行。我知道编辑该 post-receive-email 文件并且必须使用 git-diff 命令。我的问题是

我必须使用的确切 git-diff 命令是什么..?我在那个 post-receive-email 文件中添加了该命令..?gitolite 中是否有可用的配置..?

4

2 回答 2

5

2021 年更新:现在完全通过github.com/git-multimail/git-multimail

使用 Git 2.33(2021 年第三季度),从og git 本身中删除了多邮件:contrib/

请参阅Johannes Schindelin ( ) 的提交 f74d114(2021 年 6 月 10 日(由Junio C Hamano 合并 -- --提交 7e24201中,2021 年 7 月 8 日)dscho
gitster

multimail: 停止运送副本

签字人:约翰内斯·辛德林

multimail项目是独立开发的,有自己的项目页面。
传统上,我们以contrib/.

但是,这样的副本很容易变得陈旧,而将用户定向到实际项目会更好。

因此,contrib/hooks/multimail我在下面 2013 年提到的 git 2.33+(2021 年第三季度,8 年后)不再存在。


注意:您可能对新的 git-multimail 脚本感兴趣,它将包含在 git1.8.4(2013 年 7 月)中

请参阅提交 bc501f69fc6d697968d472afbabe6af97a758b12

git-multimail: 改进后接收电子邮件的替代品

Add git-multimail,一个用于生成推送到 Git 存储库的通知电子邮件的工具。
它在很大程度上与 插件兼容post-receive-email,并建议最终替换该脚本。relative to
的优点在中描述。git-multimailpost-receive-emailREADME.migrate-from-post-receive-email

git-multimail被组织在一个目录contrib/hooks/multimail中。

查看其维护的独立GitHub 项目(即使该项目将在contrib/hooks/multimail启动 git1.8.4 时集成)

你补充说:

echo ""
echo "Line of changes:"
git diff --diff-filter=M --find-copies-harder --no-prefix --unified=2 $oldrev..$newrev

You would add it in the git_multimail.py python script, just after the diff-tree.
Plus, you can fork the GitHub project, and propose a multimailhook.diffFilterOpts new option, for your diff --diff-filter addition.

于 2013-07-25T07:29:09.810 回答
0

根据githooks(5),您可以编写一个post-receive脚本来获取标准输入的每一行(也就是受影响的分支),log第一个和第二个字段(cut -d' ' -f1, cut -d' ' -f2)之间的每个提交,以及git show每个提交。

将所有这些信息存储在一个变量中,然后邮寄——然后你就完成了。

我认为您可以首先将您的post-receive-email钩子复制到您的钩子目录中(而不是链接它),然后修改它以获得新的电子邮件正文。

如果您发布当前的钩子脚本,告诉您如何修改它可能会更容易。

于 2012-12-21T05:47:59.603 回答