uTools-Manuals/docs/git/git patch-id.html
2019-04-08 23:22:26 +08:00

1 line
3.2 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="c-markdown doc-markdown"><div class="doc-postil"><div class="c-markdown"><h2>名称</h2></div></div><div class="doc-postil"><div class="c-markdown"><p>git-patch-id  - 计算补丁的唯一 ID</p></div></div><div class="doc-postil"><div class="c-markdown"><h2>概要</h2></div></div><div class="doc-postil"><div class="c-markdown"><pre class="prism-token token language-javascript">git patch-id [--stable | --unstable]</pre></div></div><div class="doc-postil"><div class="c-markdown"><h2>描述</h2></div></div><div class="doc-postil"><div class="c-markdown"><p>从标准输入中读取补丁并为其计算补丁 ID。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>“补丁ID”只不过是与补丁相关的文件差异的 SHA-1之和忽略空白和行号。因此它“相当稳定”但同时也是相当独特的即具有相同“补丁ID”的两个补丁几乎保证是相同的东西。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>IOW你可以使用这个东西来寻找可能的重复提交。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>在处理<code>git diff-tree</code>输出时它利用了补丁前缀为提交的对象名称并输出两个40字节的十六进制字符串的事实。第一个字符串是补丁ID第二个字符串是提交ID。这可以用来制作从补丁ID到提交ID的映射。</p></div></div><div class="doc-postil"><div class="c-markdown"><h2>选项</h2></div></div><div class="doc-postil"><div class="c-markdown"><p>--stable</p></div></div><div class="doc-postil"><div class="c-markdown"><p>使用“稳定”的哈希总和作为补丁 ID。有了这个选项</p></div></div><div class="doc-postil"><div class="c-markdown"><ul class="ul-level-0 list-paddingleft-2" style="margin: 10px 0px 10px 20px;"><li><p>重新排序组成补丁的文件差异不会影响ID。特别是通过将相同的两棵树与“-O &lt;orderfile&gt;”的两个不同设置进行比较而产生的两个补丁导致相同的补丁ID签名从而允许计算结果用作索引关于两棵树之间的变化;</p></li></ul></div></div><div class="doc-postil"><div class="c-markdown"><ul class="ul-level-0 list-paddingleft-2" style="margin: 10px 0px 10px 20px;"><li><p>结果与 git 1.9及更早版本产生的值不同或者当配置了“unstable”散列请参阅下面的--unstable时产生的值 - 即使在不使用“-O &lt;orderfile&gt;”的情况下使用差异输出时从而使现有数据库存储这种“不稳定”或历史补丁ID不可用。</p></li></ul></div></div><div class="doc-postil"><div class="c-markdown"><p>如果 patchid.stable 设置为 true这是默认值。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>--unstable</p></div></div><div class="doc-postil"><div class="c-markdown"><p>使用“unstable”散列作为修补程序ID。使用此选项产生的结果与 git 1.9及更早版本生成的 patch-id 值兼容。预先存在的数据库存储由 git 1.9及更高版本不涉及重新排序的补丁生成的补丁id的用户可能需要使用此选项。</p></div></div><div class="doc-postil"><div class="c-markdown"><pre class="prism-token token language-javascript">This is the default.</pre></div></div></div>