The commit 487128950df6ee433c131b5feaafe81ee86629f4
can be found at https://github.com/signalwire/freeswitch.git.
git log -1 487128950df6ee433c131b5feaafe81ee86629f4 --pretty=fuller
prints:
commit 487128950df6ee433c131b5feaafe81ee86629f4
Author: Travis Cross <[email protected]>
AuthorDate: Fri Mar 21 06:12:02 2014 +0000
Author: Anthony Minessale <[email protected]>
AuthorDate: Fri Mar 14 02:59:13 2014 +0500
Commit: Travis Cross <[email protected]>
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.
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
.
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
?
You can attribute a commit to more than one author by adding one or more Co-authored-by trailers to the commit's message. Co-authored commits are visible on GitHub.
Commit object type The commit object contains the directory tree object hash, parent commit hash, author, committer, date and message.
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 <[email protected]> 1395382322 +0000
author Anthony Minessale <[email protected]> 1394747953 +0500
committer Travis Cross <[email protected]> 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.
I'm curious how this commit was created.
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.
Why is such a commit considered as a bad object by git fsck?
Internally, Git can only have one author per commit. Allowing multiple authors would require reworking the internals.
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".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With