Details
Hello folks,
FreeBSD project gets contributions from multiple sources. Aside from our Phabricator instance we get a good volume of contributions from github.com.
Many FreeBSD maintainers are using "download raw diff" functionality both on github and on Phab to download the patch and then apply it using git am.
Very often the person committing the change is not the same person that authored the change.
Unfortunately Phabricator/Phorge does not include the ownership/attribution information of the patch. Consider these 2 diffs:
- https://patch-diff.githubusercontent.com/raw/freebsd/freebsd-src/pull/701.patch
- https://reviews.freebsd.org/file/data/ltesla2ovnjrdo3hfqsr/PHID-FILE-ptqydl4sc252vyxnbdfc/D38826.diff
- same on phorge https://we.phorge.it/file/data/uuysutiv7zh3le32h6ty/PHID-FILE-vpsv2eebjcx2vlwlr4pu/D25118.diff
As you can see github generates lines From, Date, Subject, emulating email message. This makes it really handy to feed this into git-am
Without this the information about the Author of the change is lost.
man git-am :
The commit author name is taken from the "From: " line of the message, and commit author date is taken from the "Date: " line of the message. The "Subject: " line is used as the title of the commit, after stripping common prefix "[PATCH <anything>]". The "Subject: " line is supposed to concisely describe what the commit is about in one line of text.
Attribution information is necessary to generate correct commit messages. Example: https://cgit.freebsd.org/src/commit/?id=4c41f4a0d67fc93cfb07ad5287f02d024d19ef5a a change that I authored, but did not commit.
Today FreeBSD maintainers need to add attribution manually when downloading diffs from Phabricator.
Questions:
- Is it possible to add this feature to Phorge? It feels like it shouldn't be too hard todo, considering that Phorge knows author's email, name and date of the submission of the Diff
- We are not using arc land. Should we? Does it generate attribution information for us?
Answers
https://freebsdfoundation.org/wp-content/uploads/2021/11/FreeBSD-Code-Review-with-git-arc.pdf
A bit more context about how arc is used at FreeBSD (an article from FreeBSD Journal)
Hi!
Do I understand correctly that "attribution" in this context is limited to author name, email, and date (git commit field author)?
Adding this info the the download raw feature should be fine - this is technically "patch" format, which has enough room for comments.
But I think a better interaction is to use arc patch to download a change and arc land to push it - these commands do keep the attribution information (as well as more information from the Revision description and other fields).
GitHub also has a feature similar to arc patch - it's git pull origin <some-magic-reference>, that still strikes me as easier to use than downloading a raw patch.
You can use arc land --hold to see the exact commits that would be pushed. You can look here for what information is kept - we use arc land for almost all of the changes being landed.
(If your team doesn't like to use arc, we have an open discussion about "why" in T15096, and would appreciate some input...)