Annotation of htdocs/developers/commit-guidelines.html, revision 1.83

1.50      jym         1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
1.31      kano        2: <html>
1.1       jschauma    3: <head>
                      4: <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
1.27      heinz       5: <meta name="generator" content="Website XSL Stylesheet V2.6.0">
1.21      jschauma    6: <link rel="home" href="../." title="Welcome to The NetBSD Project: Of course it runs NetBSD.">
                      7: <link rel="up" href="../developers/." title="NetBSD Developer Documentation">
1.27      heinz       8: <link rel="previous" href="../developers/announce.html" title="NetBSD Developer Documentation: News story guidelines">
1.30      wiz         9: <link rel="next" href="../developers/cvs-repos/." title="CVS Repository Issues">
1.27      heinz      10: <link rel="first" href="../developers/announce.html" title="NetBSD Developer Documentation: News story guidelines">
                     11: <link rel="last" href="../developers/www.html" title="NetBSD Developer Documentation: Information about the www
                     12:       mailing list">
1.41      dsieger    13: <link rel="stylesheet" href="../global.css" type="text/css">
1.80      maya       14: <link rel="stylesheet" href="../donations/thermo/fundraiser.css" type="text/css">
1.1       jschauma   15: <title>NetBSD Commit Guidelines</title>
                     16: </head>
1.81      maya       17: <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
1.27      heinz      18: <body class="website"><div class="webpage">
1.74      maya       19: <a name="developers-commit-guidelines"></a><div id="top"><a href="#mainContent" id="skiplink" tabindex="1">Skip to main content.</a></div>
1.81      maya       20: <input id="hamburger" type="checkbox"><label class="menuicon" for="hamburger"><span></span><span></span><span></span></label><div id="navBar" role="navigation">
1.62      maya       21: <div id="centralHeader"><div id="logo">
1.82      maya       22: <a href="../"><img id="projectLogo" alt="" height="120" src="../images/NetBSD-smaller-tb.png"></a><a href="/"><div id="fundraiser">
1.80      maya       23: <br><div id="fundraiser-amount"><div id="fundraiser-raised"></div></div>
                     24: </div></a>
1.62      maya       25: </div></div>
1.37      dsieger    26: <span class="doNotDisplay">
                     27:          Navigation:
1.50      jym        28:        </span><ul>
                     29: <li>
                     30: <a href="../">
1.83    ! maya       31:          Home</a><ul>
1.50      jym        32: <li><a href="../changes/">
                     33:            Recent changes</a></li>
1.65      maya       34: <li><a href="//blog.NetBSD.org/">
1.50      jym        35:            NetBSD blog</a></li>
1.79      maya       36: <li><a href="../gallery/presentations/">
                     37:            Presentations</a></li>
1.50      jym        38: </ul>
                     39: </li>
                     40: <li>
                     41: <a href="../about/">
                     42:          About</a><ul>
1.71      maya       43: <li><a href="../people/developers.html">
1.83    ! maya       44:            Developers</a></li>
1.50      jym        45: <li><a href="../gallery/">
1.76      leot       46:            Gallery</a></li>
1.83    ! maya       47: <li><a href="//wiki.NetBSD.org/ports/">
        !            48:            Ports</a></li>
        !            49: <li><a href="http://pkgsrc.se">
        !            50:            Packages</a></li>
1.50      jym        51: </ul>
                     52: </li>
                     53: <li>
                     54: <a href="../docs/">
                     55:          Documentation</a><ul>
                     56: <li><a href="../docs/misc/index.html">
                     57:            FAQ &amp; HOWTOs</a></li>
                     58: <li><a href="../docs/guide/en/">
                     59:            The Guide</a></li>
1.77      reed       60: <li><a href="https://man.NetBSD.org/">
1.50      jym        61:            Manual pages</a></li>
1.65      maya       62: <li><a href="//wiki.NetBSD.org/">
1.50      jym        63:            Wiki</a></li>
                     64: </ul>
                     65: </li>
                     66: <li>
                     67: <a href="../support/">
                     68:          Support</a><ul>
1.83    ! maya       69: <li><a href="//wiki.NetBSD.org/community/">
        !            70:            Community</a></li>
1.50      jym        71: <li><a href="../support/send-pr.html">
1.83    ! maya       72:            Bug reports</a></li>
1.50      jym        73: <li><a href="../support/security/">
                     74:            Security</a></li>
                     75: </ul>
                     76: </li>
                     77: <li>
                     78: <a href="../developers/">
                     79:          Developers</a><ul>
1.67      maya       80: <li><a href="http://cvsweb.NetBSD.org/">
1.83    ! maya       81:            CVSWeb</a></li>
        !            82: <li><a href="//anonhg.NetBSD.org/">
        !            83:            Mercurial</a></li>
1.65      maya       84: <li><a href="//nxr.NetBSD.org/">
1.50      jym        85:            Cross-reference</a></li>
1.65      maya       86: <li><a href="//releng.NetBSD.org/">
1.50      jym        87:            Release engineering</a></li>
1.65      maya       88: <li><a href="//wiki.NetBSD.org/projects/">
1.50      jym        89:            Projects list</a></li>
                     90: </ul>
                     91: </li>
                     92: </ul>
1.34      dsieger    93: </div>
1.73      maya       94: <div id="content"><div id="mainContent" class="fullWidth"><div class="rowOfBoxes">
1.34      dsieger    95: <h1>NetBSD Commit Guidelines</h1>
1.55      tron       96: <div class="sect1">
1.12      wiz        97: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.1       jschauma   98: <a name="guidelines"></a>
                     99:   The following Commit Guidelines define the Project's standards for making
                    100:   commits to the source tree:
1.12      wiz       101: </h2></div></div></div>
1.1       jschauma  102: 
                    103: 
                    104: 
1.48      spz       105: <div class="orderedlist"><ol class="orderedlist" type="1">
                    106: <li class="listitem">
1.55      tron      107:     <div class="sect2">
1.12      wiz       108: <div class="titlepage"><div><div><h3 class="title">
                    109: <a name="know-thy-code"></a>Commit only code you are familiar with.</h3></div></div></div>
1.1       jschauma  110:       
                    111:       <p>
                    112:         If you are not sure if the code you plan to commit is acceptable
                    113:         (e. g. when taking code that was submitted with a problem report),
                    114:        ask a developer who is familiar with that part of the system for
                    115:        review. If you're new to the Project, check with your sponsor.
                    116:       </p>
                    117:     </div>
                    118:    </li>
1.48      spz       119: <li class="listitem">
1.55      tron      120:     <div class="sect2">
1.12      wiz       121: <div class="titlepage"><div><div><h3 class="title">
                    122: <a name="tainted"></a>Do not commit tainted code to the repository.</h3></div></div></div>
1.1       jschauma  123:       
                    124:       <p>
                    125:        If you commit code that was not written by yourself, double check
                    126:        that the license on that code permits import into the NetBSD source
                    127:        repository, and permits free distribution. Check with the author(s)
                    128:        of the code, make sure that they were the sole author of the code
                    129:        and verify with them that they did not copy any other code.
                    130:       </p>
                    131:     </div>
                    132:    </li>
1.48      spz       133: <li class="listitem">
1.55      tron      134:     <div class="sect2">
1.12      wiz       135: <div class="titlepage"><div><div><h3 class="title">
1.29      jschauma  136: <a name="repository"></a>Do not commit code from foreign trees.</h3></div></div></div>
                    137:       
                    138:       <p>
                    139:        Do not commit code from a tree checked out from anywhere but from
                    140:        cvs.NetBSD.org.  Note that all developers have access to the private
1.41      dsieger   141:        <a class="ulink" href="restricted.html#rsync" target="_top">rsync-over-ssh service on
1.29      jschauma  142:        cvs.NetBSD.org</a>.
                    143:       </p>
                    144:     </div>
                    145:    </li>
1.48      spz       146: <li class="listitem">
1.55      tron      147:     <div class="sect2">
1.29      jschauma  148: <div class="titlepage"><div><div><h3 class="title">
1.1       jschauma  149: <a name="intrusive"></a>
                    150:        The more intrusive your changes are the higher is the level of
                    151:        required prior approval.
1.12      wiz       152:       </h3></div></div></div>
1.1       jschauma  153:       
1.55      tron      154:       <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.48      spz       155: <li class="listitem">
1.1       jschauma  156:           <p>
                    157:            "Obvious" fixes can be committed without any prior discussion
                    158:            or review. (The definition of "obvious" in the GCC Project is:
                    159:            "could not possibly cause anyone to object." We adopt this
                    160:            definition here)
                    161:          </p>
                    162:        </li>
1.48      spz       163: <li class="listitem">
1.1       jschauma  164:          <p>
                    165:            All other (i. e. "non-obvious") fixes <span class="emphasis"><em>should</em></span>
                    166:            have a review.
                    167:          </p>
                    168:        </li>
1.48      spz       169: <li class="listitem">
1.1       jschauma  170:          <p>
                    171:            Implementing (significant) new features requires a prior
                    172:            discussion on an appropriate technical mailing list.
                    173:          </p>
                    174:        </li>
1.48      spz       175: <li class="listitem">
1.1       jschauma  176:          <p>
1.46      pooka     177:            Adding a completely new package (e.g. openldap) requires
                    178:            prior discussion on a mailing list <span class="emphasis"><em>and</em></span>
                    179:            approval from core.
1.1       jschauma  180:          </p>
                    181:        </li>
                    182: </ul></div>
                    183:     </div>
                    184:    </li>
1.48      spz       185: <li class="listitem">
1.55      tron      186:     <div class="sect2">
1.12      wiz       187: <div class="titlepage"><div><div><h3 class="title">
                    188: <a name="tested"></a>Commit only code that you have tested.</h3></div></div></div>
1.1       jschauma  189:       
                    190:        <p>
                    191:          Make sure that your code actually works as expected, by
                    192:          compiling and running the code that is affected by your change
                    193:          with your system's tools. If you changed a man page, make sure
                    194:          that groff/nroff creates the formatted man page you expect.
                    195:        </p>
                    196:        <p>
                    197:          For normal commits (to the trunk), test that your code works
1.31      kano      198:          on -current. Prior to requesting a pull-up to a branch, test
1.1       jschauma  199:          the very changes you will request from releng on the respective
                    200:          release branch.
                    201:        </p>
1.45      pooka     202:        <p>
                    203:          Run all relevant tests from
                    204:          <code class="filename">/usr/tests</code> or
                    205:          ideally the whole test suite.  The logs of the automated
                    206:          test runs are currently available
                    207:          <a class="ulink" href="http://www.gson.org/netbsd/bugs/build/" target="_top">here</a>.
                    208:          Long-term regressions (build breakage or failing tests)
                    209:          are not acceptable and changes causing such will be backed
                    210:          out if the regressions are not addressed.
                    211:        </p>
1.1       jschauma  212:      </div>
                    213:     </li>
1.48      spz       214: <li class="listitem">
1.55      tron      215:       <div class="sect2">
1.12      wiz       216: <div class="titlepage"><div><div><h3 class="title">
                    217: <a name="group"></a>Group commits together that are part of the same fix.</h3></div></div></div>
1.1       jschauma  218:        
                    219:        <p>
                    220:          Rototilling a make variable that affects 50 Makefiles should get
                    221:           one commit for all of them together.
                    222:        </p>
                    223:       </div>
                    224:     </li>
1.48      spz       225: <li class="listitem">
1.55      tron      226:       <div class="sect2">
1.12      wiz       227: <div class="titlepage"><div><div><h3 class="title">
                    228: <a name="separate"></a>Each commit should be a separate patch/fix/addition/etc.</h3></div></div></div>
1.1       jschauma  229:        
                    230:        <p>
                    231:          Don't fix 3 bugs with the same commit and roll that into
                    232:          "Fixed some bugs". Fix one, test, commit, rinse, repeat. This
                    233:          makes life infinitely easier for releng to pull up fixes since
                    234:          often not everything applies to a given branch.
                    235:        </p>
                    236:       </div>
                    237:     </li>
1.48      spz       238: <li class="listitem">
1.55      tron      239:       <div class="sect2">
1.12      wiz       240: <div class="titlepage"><div><div><h3 class="title">
1.1       jschauma  241: <a name="dont-mix"></a>
                    242:          Do not mix functionality or bug-fix patches with
                    243:          whitespace/layout updates.
1.12      wiz       244:        </h3></div></div></div>
1.1       jschauma  245:        
                    246:         <p>
                    247:          Do those separately (apart from the general requirement that
                    248:          changes be made in such a way that it is easy to discern what
                    249:          each fix did, as described in item 6, there will be pullup
                    250:          issues with largely changed files from trunk-&gt;branch when
                    251:          mixing whitespace with functionality fixes).
                    252:        </p>
                    253:       </div>
                    254:     </li>
1.48      spz       255: <li class="listitem">
1.55      tron      256:       <div class="sect2">
1.12      wiz       257: <div class="titlepage"><div><div><h3 class="title">
1.46      pooka     258: <a name="document"></a>Clearly document the reasons for your changes in
                    259:               the commit log.</h3></div></div></div>
1.1       jschauma  260:        
                    261:        <p>
1.46      pooka     262:          Detail to some degree what was changed and why.  This
                    263:          doesn't need to be a code review/walkthrough but it should
                    264:          be informative to someone reading the log and looking
                    265:          over the diff in 6 months.  The focus should be on "why"
                    266:          since the target audience reading the logs can usually
                    267:          figure out "what" from looking the diffs.  As an exercise,
                    268:          consider the difference of usefulness between "set i to
                    269:          1" and "initialize iterator correctly to fix a rarely
                    270:          triggering bug in memory handling".
                    271:        </p>
                    272: 
                    273:        <p>
                    274:          Also, "fixed some stuff" or "cvs-1.10.0" isn't informative
                    275:          whereas the following example is:
1.1       jschauma  276:        </p>
                    277:        <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
                    278: <h3 class="title"></h3>
                    279:           "Print useful line number on error while executing .for directive."
                    280:         </div>
                    281:        <p>
1.32      heinz     282:          If your change fixes a PR, document it with an appropriate
1.48      spz       283:          message. Using the template <span class="quote">&#8220;<span class="quote">PR category/bug-id</span>&#8221;</span> in
1.32      heinz     284:          your commit message will also append it to the respective problem
                    285:          report in our bug database:
1.1       jschauma  286:        </p>
                    287:        <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
                    288: <h3 class="title"></h3>
                    289:           "Closes PR bin/6666"
                    290:         </div>
                    291:        <p>
                    292:          If your code has been reviewed by someone else, document this:
                    293:        </p>
                    294:        <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
                    295: <h3 class="title"></h3>
                    296:           "Reviewed by &lt;mrg&gt;"
                    297:        </div>
                    298:        <p>
                    299:          (Please note that a good commit log doesn't relieve the need
                    300:          for good documentation in the program itself.)
                    301:        </p>
                    302:       </div>
                    303:     </li>
1.48      spz       304: <li class="listitem">
1.55      tron      305:       <div class="sect2">
1.12      wiz       306: <div class="titlepage"><div><div><h3 class="title">
                    307: <a name="credit"></a>Give proper credit.</h3></div></div></div>
1.1       jschauma  308:        
                    309:        <p>
                    310:          If you commit code that had been submitted in a PR, give
                    311:          proper credit, like:
                    312:        </p>
                    313:        <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
                    314: <h3 class="title"></h3>
                    315:            "Code submitted in PR lib/393939 by Joe Doe"
                    316:        </div>
                    317:        <p>
                    318:          Since the commit messages will eventually appear on the
                    319:          source-changes mailing list which is also available via web,
                    320:          specifying the e-mail addresses of the PR submitter should
                    321:          generally be avoided.
                    322:        </p>
                    323:        <p>
                    324:          If you took code from an other Open Source Project, give
                    325:          credit, like:
                    326:        </p>
                    327:        <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
                    328: <h3 class="title"></h3>
                    329:           "From FreeBSD"
                    330:        </div>
                    331:       </div>
                    332:     </li>
1.48      spz       333: <li class="listitem">
1.55      tron      334:       <div class="sect2">
1.12      wiz       335: <div class="titlepage"><div><div><h3 class="title">
                    336: <a name="revert"></a>Do not revert other developer's commits.</h3></div></div></div>
1.1       jschauma  337:        
                    338:        <p>
                    339:          If you do not agree with another developer's commit, do not
                    340:          revert it on your own. Contact the other developer and explain
1.47      spz       341:          to him or her the issues you have with the commit in question.
                    342:           Ask the other developer to back out the changes instead of
                    343:           doing it yourself.
1.1       jschauma  344:        </p>
                    345:        <p>
1.70      leot      346:          If no agreement can be reached, contact the Core Team
                    347:          &lt;core@NetBSD.org&gt;, which
1.1       jschauma  348:          will serve as mediation authority.
                    349:        </p>
                    350:       </div>
                    351:   </li>
                    352: </ol></div>
                    353: 
                    354: </div>
1.34      dsieger   355: </div></div></div>
                    356: <div class="navfoot"></div>
1.43      mishka    357: <div id="footer"><div id="footerContent"><center>
1.65      maya      358: <span class="footfeed"><a href="//www.NetBSD.org/cgi-bin/feedback.cgi">
1.34      dsieger   359:          Contact</a> |
1.40      kano      360:       </span><span class="footcopy"><a href="../about/disclaimer.html">
1.34      dsieger   361:       Disclaimer</a> |
1.1       jschauma  362: 
1.78      leot      363:       <span class="copyright">Copyright © 1994-2020 The NetBSD Foundation, Inc. </span>ALL RIGHTS RESERVED.<br>NetBSD<sup>®</sup> is a registered trademark of The NetBSD
1.34      dsieger   364:        Foundation, Inc.</span>
1.43      mishka    365: </center></div></div>
1.1       jschauma  366: </div></body>
                    367: </html>

CVSweb <webmaster@jp.NetBSD.org>