一个提交对象有2个作者怎么可能? [英] How can it be that a commit object has 2 authors?

查看:67
本文介绍了一个提交对象有2个作者怎么可能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

提交 487128950df6ee433c131b5feaafe81ee86629f4 可以在 https://github.com/上找到signalwire/freeswitch.git .

git log -1 487128950df6ee433c131b5feaafe81ee86629f4 --pretty = fuller 打印:

commit 487128950df6ee433c131b5feaafe81ee86629f4
Author:     Travis Cross <tc@traviscross.com>
AuthorDate: Fri Mar 21 06:12:02 2014 +0000
Author:     Anthony Minessale <anthm@freeswitch.org>
AuthorDate: Fri Mar 14 02:59:13 2014 +0500
Commit:     Travis Cross <tc@traviscross.com>
CommitDate: Mon Mar 24 12:54:50 2014 +0000

    Use the system version of APR / APR-util if possible

    Autodetect whether the system libapr / libaprutil has our
    necessary modifications and use it if it does.

有2位作者.如果启用了fsck检查,则将此提交推送到Gitlab或Github可能会失败,并抱怨 remote:error:object 487128950df6ee433c131b5feaafe81ee86629f4:multipleAuthors:无效的格式-多行作者"行.

It has 2 authors. Pushing this commit to Gitlab or Github could fail if fsck check is on, complaining remote: error: object 487128950df6ee433c131b5feaafe81ee86629f4: multipleAuthors: invalid format - multiple 'author' lines.

我很好奇这个提交是如何创建的.记录多位作者的解决方案之一是在提交消息中附加 Co-authored by .由于可以由两个作者创建一个提交,为什么它不是内置方法呢?为何 git fsck 将此提交视为不良对象?

I'm curious how this commit was created. One of the solutions to record multiple authors is appending Co-authored-by in the commit message. As it's possible to create a commit with two authors, why hasn't it been a built-in method? And why is such a commit considered as a bad object by git fsck?

推荐答案

git提交对象是

A git commit object is just a compressed text file. This one happens to have two authors.

$ pigz -d < .git/objects/48/7128950df6ee433c131b5feaafe81ee86629f4 
commit 438tree 070633dfc3ea352dfb1094822f477111e519a9ca
parent cde20f6fe68523d9416d2fed72435a8ba880a269
author Travis Cross <tc@traviscross.com> 1395382322 +0000
author Anthony Minessale <anthm@freeswitch.org> 1394747953 +0500
committer Travis Cross <tc@traviscross.com> 1395665690 +0000

Use the system version of APR / APR-util if possible

Autodetect whether the system libapr / libaprutil has our
necessary modifications and use it if it does.

我很好奇如何创建此提交.

您必须向特拉维斯·克罗斯(Travis Cross)询问他们是如何做到的.进行提交是只不过是将文本写入文件

You'd have to ask Travis Cross for exactly how they did it. Making a commit is not much more than writing text to a file.

为什么git fsck会将此类提交视为不良对象?

在内部, Git每次提交只能有一位作者.允许多位作者需要对内部进行重新设计.

Internally, Git can only have one author per commit. Allowing multiple authors would require reworking the internals.

git-log 将显示多个作者,这可能是一个实现上的怪癖.其他工具将不尊重两位作者.例如, git shortlog --group = author 仅计算对Anthony Minessale的提交.

While git-log will display multiple authors that's probably an implementation quirk. Other tools will not honor both authors. For example, git shortlog --group=author only counts the commit to Anthony Minessale.

如果您需要多个作者,请添加共同作者通过拖车" .

If you need multiple authors, add co-authors via "trailers".

这篇关于一个提交对象有2个作者怎么可能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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