追溯签署git提交 [英] Retroactively sign git commits

查看:127
本文介绍了追溯签署git提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近的git版本(> = 1.7.9)支持使用GPG签署单独的提交。



是否可以在树中追溯签名所有提交?

解决方案

< blockquote>

追溯签署树中的所有提交?

是:添加标记,表示您将签署

这实际上是首选项当涉及到签名提交时:通过标记签署所有这些提交,而不是单独对每一个签名。

请参阅如何让推送者的信息在接收后挂钩?





注意(2017年5月更新)只有Git 2.13.x / 2.14(Q3 2017)才能完全修复签名过程,因为 git cherry-pick 和音序器机器的其他用途,并且错误地处理了最后一行不完整行的尾部块。

这有已修复,以便在完成现有的不完整行之后添加额外的签收等。



请参阅 commit 44dc738 (2017年4月26日) Jonathan Tan( jhowtan
(由 Junio C Hamano - gitster - 位于 commit 6ebfa10 ,2017年5月16日)




sequencer :在添加页脚之前添加换行符



不会以换行符结束,
音序器在确定是否应添加空白行
之前不会完成该行。

这会导致(樱桃选择... ,并且签名线有时与提交信息的最后一行出现在同一行。



这种行为是由 commit 967dfd4 引入的(sequencer:use
预告片的预告片布局,2016-11-29)。但是,该提交
的还原不会完全解决该问题:在该提交之前,
符合页脚被认为不符合
has_conforming_footer( )如果没有终止的换行符,则在符合和不符合的页脚中,导致
被视为不应该是相同的



解决这个问题,对于符合和不符合的页脚,以及 do_pick_commit() append_signoff() / code>,通过总是在提交消息中添加一个
换行符,如果它没有在检查
符合页脚符号之前结束的话。



Recent versions of git (>= 1.7.9) support signing individual commits with GPG.

Is it possible to retroactively sign all commits within a tree?

解决方案

retroactively sign all commits within a tree?

Yes: add a tag, that you would sign.
That is actually the preferred option when it comes to sign commits: sign a all set of them through a tag, rather than signing each one individually.
See "How to get pusher's Information in post-receive hooks?".


Note (update may 2017) that only Git 2.13.x/2.14 (Q3 2017) will completely fix the signing process, because "git cherry-pick" and other uses of the sequencer machinery and mishandled a trailer block whose last line is an incomplete line.
This has been fixed so that an additional sign-off etc. are added after completing the existing incomplete line.

See commit 44dc738 (26 Apr 2017) by Jonathan Tan (jhowtan).
(Merged by Junio C Hamano -- gitster -- in commit 6ebfa10, 16 May 2017)

sequencer: add newline before adding footers

When encountering a commit message that does not end in a newline, sequencer does not complete the line before determining if a blank line should be added.
This causes the "(cherry picked..." and sign-off lines to sometimes appear on the same line as the last line of the commit message.

This behavior was introduced by commit 967dfd4 ("sequencer: use trailer's trailer layout", 2016-11-29). However, a revert of that commit would not resolve this issue completely: prior to that commit, a conforming footer was deemed to be non-conforming by has_conforming_footer() if there was no terminating newline, resulting in both conforming and non-conforming footers being treated the same when they should not be.

Resolve this issue, both for conforming and non-conforming footers, and in both do_pick_commit() and append_signoff(), by always adding a newline to the commit message if it does not end in one before checking the footer for conformity.

这篇关于追溯签署git提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆