1*2b0e4ecdSDaniel P. Berrangé.. _code-provenance: 2*2b0e4ecdSDaniel P. Berrangé 3*2b0e4ecdSDaniel P. BerrangéCode provenance 4*2b0e4ecdSDaniel P. Berrangé=============== 5*2b0e4ecdSDaniel P. Berrangé 6*2b0e4ecdSDaniel P. BerrangéCertifying patch submissions 7*2b0e4ecdSDaniel P. Berrangé~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 8*2b0e4ecdSDaniel P. Berrangé 9*2b0e4ecdSDaniel P. BerrangéThe QEMU community **mandates** all contributors to certify provenance of 10*2b0e4ecdSDaniel P. Berrangépatch submissions they make to the project. To put it another way, 11*2b0e4ecdSDaniel P. Berrangécontributors must indicate that they are legally permitted to contribute to 12*2b0e4ecdSDaniel P. Berrangéthe project. 13*2b0e4ecdSDaniel P. Berrangé 14*2b0e4ecdSDaniel P. BerrangéCertification is achieved with a low overhead by adding a single line to the 15*2b0e4ecdSDaniel P. Berrangébottom of every git commit:: 16*2b0e4ecdSDaniel P. Berrangé 17*2b0e4ecdSDaniel P. Berrangé Signed-off-by: YOUR NAME <YOUR@EMAIL> 18*2b0e4ecdSDaniel P. Berrangé 19*2b0e4ecdSDaniel P. BerrangéThe addition of this line asserts that the author of the patch is contributing 20*2b0e4ecdSDaniel P. Berrangéin accordance with the clauses specified in the 21*2b0e4ecdSDaniel P. Berrangé`Developer's Certificate of Origin <https://developercertificate.org>`__: 22*2b0e4ecdSDaniel P. Berrangé 23*2b0e4ecdSDaniel P. Berrangé.. _dco: 24*2b0e4ecdSDaniel P. Berrangé 25*2b0e4ecdSDaniel P. Berrangé Developer's Certificate of Origin 1.1 26*2b0e4ecdSDaniel P. Berrangé 27*2b0e4ecdSDaniel P. Berrangé By making a contribution to this project, I certify that: 28*2b0e4ecdSDaniel P. Berrangé 29*2b0e4ecdSDaniel P. Berrangé (a) The contribution was created in whole or in part by me and I 30*2b0e4ecdSDaniel P. Berrangé have the right to submit it under the open source license 31*2b0e4ecdSDaniel P. Berrangé indicated in the file; or 32*2b0e4ecdSDaniel P. Berrangé 33*2b0e4ecdSDaniel P. Berrangé (b) The contribution is based upon previous work that, to the best 34*2b0e4ecdSDaniel P. Berrangé of my knowledge, is covered under an appropriate open source 35*2b0e4ecdSDaniel P. Berrangé license and I have the right under that license to submit that 36*2b0e4ecdSDaniel P. Berrangé work with modifications, whether created in whole or in part 37*2b0e4ecdSDaniel P. Berrangé by me, under the same open source license (unless I am 38*2b0e4ecdSDaniel P. Berrangé permitted to submit under a different license), as indicated 39*2b0e4ecdSDaniel P. Berrangé in the file; or 40*2b0e4ecdSDaniel P. Berrangé 41*2b0e4ecdSDaniel P. Berrangé (c) The contribution was provided directly to me by some other 42*2b0e4ecdSDaniel P. Berrangé person who certified (a), (b) or (c) and I have not modified 43*2b0e4ecdSDaniel P. Berrangé it. 44*2b0e4ecdSDaniel P. Berrangé 45*2b0e4ecdSDaniel P. Berrangé (d) I understand and agree that this project and the contribution 46*2b0e4ecdSDaniel P. Berrangé are public and that a record of the contribution (including all 47*2b0e4ecdSDaniel P. Berrangé personal information I submit with it, including my sign-off) is 48*2b0e4ecdSDaniel P. Berrangé maintained indefinitely and may be redistributed consistent with 49*2b0e4ecdSDaniel P. Berrangé this project or the open source license(s) involved. 50*2b0e4ecdSDaniel P. Berrangé 51*2b0e4ecdSDaniel P. BerrangéThe name used with "Signed-off-by" does not need to be your legal name, nor 52*2b0e4ecdSDaniel P. Berrangébirth name, nor appear on any government ID. It is the identity you choose to 53*2b0e4ecdSDaniel P. Berrangébe known by in the community, but should not be anonymous, nor misrepresent 54*2b0e4ecdSDaniel P. Berrangéwhom you are. 55*2b0e4ecdSDaniel P. Berrangé 56*2b0e4ecdSDaniel P. BerrangéIt is generally expected that the name and email addresses used in one of the 57*2b0e4ecdSDaniel P. Berrangé``Signed-off-by`` lines, matches that of the git commit ``Author`` field. 58*2b0e4ecdSDaniel P. BerrangéIt's okay if you subscribe or contribute to the list via more than one 59*2b0e4ecdSDaniel P. Berrangéaddress, but using multiple addresses in one commit just confuses 60*2b0e4ecdSDaniel P. Berrangéthings. 61*2b0e4ecdSDaniel P. Berrangé 62*2b0e4ecdSDaniel P. BerrangéIf the person sending the mail is not one of the patch authors, they are 63*2b0e4ecdSDaniel P. Berrangénonetheless expected to add their own ``Signed-off-by`` to comply with the 64*2b0e4ecdSDaniel P. BerrangéDCO clause (c). 65*2b0e4ecdSDaniel P. Berrangé 66*2b0e4ecdSDaniel P. BerrangéMultiple authorship 67*2b0e4ecdSDaniel P. Berrangé~~~~~~~~~~~~~~~~~~~ 68*2b0e4ecdSDaniel P. Berrangé 69*2b0e4ecdSDaniel P. BerrangéIt is not uncommon for a patch to have contributions from multiple authors. In 70*2b0e4ecdSDaniel P. Berrangéthis scenario, git commits will usually be expected to have a ``Signed-off-by`` 71*2b0e4ecdSDaniel P. Berrangéline for each contributor involved in creation of the patch. Some edge cases: 72*2b0e4ecdSDaniel P. Berrangé 73*2b0e4ecdSDaniel P. Berrangé * The non-primary author's contributions were so trivial that they can be 74*2b0e4ecdSDaniel P. Berrangé considered not subject to copyright. In this case the secondary authors 75*2b0e4ecdSDaniel P. Berrangé need not include a ``Signed-off-by``. 76*2b0e4ecdSDaniel P. Berrangé 77*2b0e4ecdSDaniel P. Berrangé This case most commonly applies where QEMU reviewers give short snippets 78*2b0e4ecdSDaniel P. Berrangé of code as suggested fixes to a patch. The reviewers don't need to have 79*2b0e4ecdSDaniel P. Berrangé their own ``Signed-off-by`` added unless their code suggestion was 80*2b0e4ecdSDaniel P. Berrangé unusually large, but it is common to add ``Suggested-by`` as a credit 81*2b0e4ecdSDaniel P. Berrangé for non-trivial code. 82*2b0e4ecdSDaniel P. Berrangé 83*2b0e4ecdSDaniel P. Berrangé * Both contributors work for the same employer and the employer requires 84*2b0e4ecdSDaniel P. Berrangé copyright assignment. 85*2b0e4ecdSDaniel P. Berrangé 86*2b0e4ecdSDaniel P. Berrangé It can be said that in this case a ``Signed-off-by`` is indicating that 87*2b0e4ecdSDaniel P. Berrangé the person has permission to contribute from their employer who is the 88*2b0e4ecdSDaniel P. Berrangé copyright holder. It is nonetheless still preferable to include a 89*2b0e4ecdSDaniel P. Berrangé ``Signed-off-by`` for each contributor, as in some countries employees are 90*2b0e4ecdSDaniel P. Berrangé not able to assign copyright to their employer, and it also covers any 91*2b0e4ecdSDaniel P. Berrangé time invested outside working hours. 92*2b0e4ecdSDaniel P. Berrangé 93*2b0e4ecdSDaniel P. BerrangéWhen multiple ``Signed-off-by`` tags are present, they should be strictly kept 94*2b0e4ecdSDaniel P. Berrangéin order of authorship, from oldest to newest. 95*2b0e4ecdSDaniel P. Berrangé 96*2b0e4ecdSDaniel P. BerrangéOther commit tags 97*2b0e4ecdSDaniel P. Berrangé~~~~~~~~~~~~~~~~~ 98*2b0e4ecdSDaniel P. Berrangé 99*2b0e4ecdSDaniel P. BerrangéWhile the ``Signed-off-by`` tag is mandatory, there are a number of other tags 100*2b0e4ecdSDaniel P. Berrangéthat are commonly used during QEMU development: 101*2b0e4ecdSDaniel P. Berrangé 102*2b0e4ecdSDaniel P. Berrangé * **``Reviewed-by``**: when a QEMU community member reviews a patch on the 103*2b0e4ecdSDaniel P. Berrangé mailing list, if they consider the patch acceptable, they should send an 104*2b0e4ecdSDaniel P. Berrangé email reply containing a ``Reviewed-by`` tag. Subsystem maintainers who 105*2b0e4ecdSDaniel P. Berrangé review a patch should add this even if they are also adding their 106*2b0e4ecdSDaniel P. Berrangé ``Signed-off-by`` to the same commit. 107*2b0e4ecdSDaniel P. Berrangé 108*2b0e4ecdSDaniel P. Berrangé * **``Acked-by``**: when a QEMU subsystem maintainer approves a patch that 109*2b0e4ecdSDaniel P. Berrangé touches their subsystem, but intends to allow a different maintainer to 110*2b0e4ecdSDaniel P. Berrangé queue it and send a pull request, they would send a mail containing a 111*2b0e4ecdSDaniel P. Berrangé ``Acked-by`` tag. Where a patch touches multiple subsystems, ``Acked-by`` 112*2b0e4ecdSDaniel P. Berrangé only implies review of the maintainers' own areas of responsibility. If a 113*2b0e4ecdSDaniel P. Berrangé maintainer wants to indicate they have done a full review they should use 114*2b0e4ecdSDaniel P. Berrangé a ``Reviewed-by`` tag. 115*2b0e4ecdSDaniel P. Berrangé 116*2b0e4ecdSDaniel P. Berrangé * **``Tested-by``**: when a QEMU community member has functionally tested the 117*2b0e4ecdSDaniel P. Berrangé behaviour of the patch in some manner, they should send an email reply 118*2b0e4ecdSDaniel P. Berrangé containing a ``Tested-by`` tag. 119*2b0e4ecdSDaniel P. Berrangé 120*2b0e4ecdSDaniel P. Berrangé * **``Reported-by``**: when a QEMU community member reports a problem via the 121*2b0e4ecdSDaniel P. Berrangé mailing list, or some other informal channel that is not the issue tracker, 122*2b0e4ecdSDaniel P. Berrangé it is good practice to credit them by including a ``Reported-by`` tag on 123*2b0e4ecdSDaniel P. Berrangé any patch fixing the issue. When the problem is reported via the GitLab 124*2b0e4ecdSDaniel P. Berrangé issue tracker, however, it is sufficient to just include a link to the 125*2b0e4ecdSDaniel P. Berrangé issue. 126*2b0e4ecdSDaniel P. Berrangé 127*2b0e4ecdSDaniel P. Berrangé * **``Suggested-by``**: when a reviewer or other 3rd party makes non-trivial 128*2b0e4ecdSDaniel P. Berrangé suggestions for how to change a patch, it is good practice to credit them 129*2b0e4ecdSDaniel P. Berrangé by including a ``Suggested-by`` tag. 130*2b0e4ecdSDaniel P. Berrangé 131*2b0e4ecdSDaniel P. BerrangéSubsystem maintainer requirements 132*2b0e4ecdSDaniel P. Berrangé~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 133*2b0e4ecdSDaniel P. Berrangé 134*2b0e4ecdSDaniel P. BerrangéWhen a subsystem maintainer accepts a patch from a contributor, in addition to 135*2b0e4ecdSDaniel P. Berrangéthe normal code review points, they are expected to validate the presence of 136*2b0e4ecdSDaniel P. Berrangésuitable ``Signed-off-by`` tags. 137*2b0e4ecdSDaniel P. Berrangé 138*2b0e4ecdSDaniel P. BerrangéAt the time they queue the patch in their subsystem tree, the maintainer 139*2b0e4ecdSDaniel P. Berrangé**must** also then add their own ``Signed-off-by`` to indicate that they have 140*2b0e4ecdSDaniel P. Berrangédone the aforementioned validation. This is in addition to any of their own 141*2b0e4ecdSDaniel P. Berrangé``Reviewed-by`` tags the subsystem maintainer may wish to include. 142*2b0e4ecdSDaniel P. Berrangé 143*2b0e4ecdSDaniel P. BerrangéWhen the maintainer modifies the patch after pulling into their tree, they 144*2b0e4ecdSDaniel P. Berrangéshould record their contribution. This is typically done via a note in the 145*2b0e4ecdSDaniel P. Berrangécommit message, just prior to the maintainer's ``Signed-off-by``:: 146*2b0e4ecdSDaniel P. Berrangé 147*2b0e4ecdSDaniel P. Berrangé Signed-off-by: Cory Contributor <cory.contributor@example.com> 148*2b0e4ecdSDaniel P. Berrangé [Comment rephrased for clarity] 149*2b0e4ecdSDaniel P. Berrangé Signed-off-by: Mary Maintainer <mary.maintainer@mycorp.test> 150*2b0e4ecdSDaniel P. Berrangé 151*2b0e4ecdSDaniel P. Berrangé 152*2b0e4ecdSDaniel P. BerrangéTools for adding ``Signed-off-by`` 153*2b0e4ecdSDaniel P. Berrangé~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 154*2b0e4ecdSDaniel P. Berrangé 155*2b0e4ecdSDaniel P. BerrangéThere are a variety of ways tools can support adding ``Signed-off-by`` tags 156*2b0e4ecdSDaniel P. Berrangéfor patches, avoiding the need for contributors to manually type in this 157*2b0e4ecdSDaniel P. Berrangérepetitive text each time. 158*2b0e4ecdSDaniel P. Berrangé 159*2b0e4ecdSDaniel P. Berrangégit commands 160*2b0e4ecdSDaniel P. Berrangé^^^^^^^^^^^^ 161*2b0e4ecdSDaniel P. Berrangé 162*2b0e4ecdSDaniel P. BerrangéWhen creating, or amending, a commit the ``-s`` flag to ``git commit`` will 163*2b0e4ecdSDaniel P. Berrangéappend a suitable line matching the configured git author details. 164*2b0e4ecdSDaniel P. Berrangé 165*2b0e4ecdSDaniel P. BerrangéIf preparing patches using the ``git format-patch`` tool, the ``-s`` flag can 166*2b0e4ecdSDaniel P. Berrangébe used to append a suitable line in the emails it creates, without modifying 167*2b0e4ecdSDaniel P. Berrangéthe local commits. Alternatively to modify all the local commits on a branch:: 168*2b0e4ecdSDaniel P. Berrangé 169*2b0e4ecdSDaniel P. Berrangé git rebase master -x 'git commit --amend --no-edit -s' 170*2b0e4ecdSDaniel P. Berrangé 171*2b0e4ecdSDaniel P. Berrangéemacs 172*2b0e4ecdSDaniel P. Berrangé^^^^^ 173*2b0e4ecdSDaniel P. Berrangé 174*2b0e4ecdSDaniel P. BerrangéIn the file ``$HOME/.emacs.d/abbrev_defs`` add: 175*2b0e4ecdSDaniel P. Berrangé 176*2b0e4ecdSDaniel P. Berrangé.. code:: elisp 177*2b0e4ecdSDaniel P. Berrangé 178*2b0e4ecdSDaniel P. Berrangé (define-abbrev-table 'global-abbrev-table 179*2b0e4ecdSDaniel P. Berrangé '( 180*2b0e4ecdSDaniel P. Berrangé ("8rev" "Reviewed-by: YOUR NAME <your@email.addr>" nil 1) 181*2b0e4ecdSDaniel P. Berrangé ("8ack" "Acked-by: YOUR NAME <your@email.addr>" nil 1) 182*2b0e4ecdSDaniel P. Berrangé ("8test" "Tested-by: YOUR NAME <your@email.addr>" nil 1) 183*2b0e4ecdSDaniel P. Berrangé ("8sob" "Signed-off-by: YOUR NAME <your@email.addr>" nil 1) 184*2b0e4ecdSDaniel P. Berrangé )) 185*2b0e4ecdSDaniel P. Berrangé 186*2b0e4ecdSDaniel P. Berrangéwith this change, if you type (for example) ``8rev`` followed by ``<space>`` 187*2b0e4ecdSDaniel P. Berrangéor ``<enter>`` it will expand to the whole phrase. 188*2b0e4ecdSDaniel P. Berrangé 189*2b0e4ecdSDaniel P. Berrangévim 190*2b0e4ecdSDaniel P. Berrangé^^^ 191*2b0e4ecdSDaniel P. Berrangé 192*2b0e4ecdSDaniel P. BerrangéIn the file ``$HOME/.vimrc`` add:: 193*2b0e4ecdSDaniel P. Berrangé 194*2b0e4ecdSDaniel P. Berrangé iabbrev 8rev Reviewed-by: YOUR NAME <your@email.addr> 195*2b0e4ecdSDaniel P. Berrangé iabbrev 8ack Acked-by: YOUR NAME <your@email.addr> 196*2b0e4ecdSDaniel P. Berrangé iabbrev 8test Tested-by: YOUR NAME <your@email.addr> 197*2b0e4ecdSDaniel P. Berrangé iabbrev 8sob Signed-off-by: YOUR NAME <your@email.addr> 198*2b0e4ecdSDaniel P. Berrangé 199*2b0e4ecdSDaniel P. Berrangéwith this change, if you type (for example) ``8rev`` followed by ``<space>`` 200*2b0e4ecdSDaniel P. Berrangéor ``<enter>`` it will expand to the whole phrase. 201*2b0e4ecdSDaniel P. Berrangé 202*2b0e4ecdSDaniel P. BerrangéRe-starting abandoned work 203*2b0e4ecdSDaniel P. Berrangé~~~~~~~~~~~~~~~~~~~~~~~~~~ 204*2b0e4ecdSDaniel P. Berrangé 205*2b0e4ecdSDaniel P. BerrangéFor a variety of reasons there are some patches that get submitted to QEMU but 206*2b0e4ecdSDaniel P. Berrangénever merged. An unrelated contributor may decide (months or years later) to 207*2b0e4ecdSDaniel P. Berrangécontinue working from the abandoned patch and re-submit it with extra changes. 208*2b0e4ecdSDaniel P. Berrangé 209*2b0e4ecdSDaniel P. BerrangéThe general principles when picking up abandoned work are: 210*2b0e4ecdSDaniel P. Berrangé 211*2b0e4ecdSDaniel P. Berrangé * Continue to credit the original author for their work, by maintaining their 212*2b0e4ecdSDaniel P. Berrangé original ``Signed-off-by`` 213*2b0e4ecdSDaniel P. Berrangé * Indicate where the original patch was obtained from (mailing list, bug 214*2b0e4ecdSDaniel P. Berrangé tracker, author's git repo, etc) when sending it for review 215*2b0e4ecdSDaniel P. Berrangé * Acknowledge the extra work of the new contributor by including their 216*2b0e4ecdSDaniel P. Berrangé ``Signed-off-by`` in the patch in addition to the orignal author's 217*2b0e4ecdSDaniel P. Berrangé * Indicate who is responsible for what parts of the patch. This is typically 218*2b0e4ecdSDaniel P. Berrangé done via a note in the commit message, just prior to the new contributor's 219*2b0e4ecdSDaniel P. Berrangé ``Signed-off-by``:: 220*2b0e4ecdSDaniel P. Berrangé 221*2b0e4ecdSDaniel P. Berrangé Signed-off-by: Some Person <some.person@example.com> 222*2b0e4ecdSDaniel P. Berrangé [Rebased and added support for 'foo'] 223*2b0e4ecdSDaniel P. Berrangé Signed-off-by: New Person <new.person@mycorp.test> 224*2b0e4ecdSDaniel P. Berrangé 225*2b0e4ecdSDaniel P. BerrangéIn complicated cases, or if otherwise unsure, ask for advice on the project 226*2b0e4ecdSDaniel P. Berrangémailing list. 227*2b0e4ecdSDaniel P. Berrangé 228*2b0e4ecdSDaniel P. BerrangéIt is also recommended to attempt to contact the original author to let them 229*2b0e4ecdSDaniel P. Berrangéknow you are interested in taking over their work, in case they still intended 230*2b0e4ecdSDaniel P. Berrangéto return to the work, or had any suggestions about the best way to continue. 231