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

1.1       jschauma    1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
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.1       jschauma   14: <title>NetBSD Commit Guidelines</title>
                     15: </head>
1.27      heinz      16: <body class="website"><div class="webpage">
1.34      dsieger    17: <a name="developers-commit-guidelines"></a><div id="top"><a href="#mainContent" class="doNotDisplay doNotPrint">Skip to main content.</a></div>
                     18: <div id="header">
                     19: <div class="topNavigation">
1.37      dsieger    20: <span>» </span><a href="../docs/guide/en/">
                     21:          The Guide</a> |
1.34      dsieger    22:        <a href="http://man.NetBSD.org/">Manual pages</a> |
1.39      kano       23:        <a href="../mailinglists/">
1.37      dsieger    24:          Mailing lists</a> and
1.34      dsieger    25:        <a href="http://mail-index.NetBSD.org/">Archives</a> |
                     26:        <a href="http://cvsweb.NetBSD.org/">CVS repository</a> |
1.37      dsieger    27:        <a href="http://www.NetBSD.org/cgi-bin/sendpr.cgi?gndb=netbsd">Report</a>
                     28:        or 
1.40      kano       29:        <a href="../support/query-pr.html">
                     30:          query</a> a bug |
1.37      dsieger    31:        <a href="../docs/software/packages.html">
                     32:          Software Packages
                     33:        </a>
1.34      dsieger    34: </div>
                     35: <div class="centralHeader">
1.37      dsieger    36: <a href="../"><img alt="[NetBSD Logo]" width="506" height="90" src="../images/NetBSD-headerlogo.png"></a><div class="headerTools"><div id="headerSearch"><form method="get" action="http://www.google.com/custom">
1.35      dsieger    37: <input class="whiteOnBlack" type="text" name="q" onfocus="if(this.value==this.defaultValue ) this.value='';" size="12" maxlength="255" value="Search"><input type="hidden" name="cof" value="L:http://www.NetBSD.org/images/NetBSD-smaller.png;LH:200;LW:200;AH:center;AWFID:4f6b0499f0f58d2c;"><input type="hidden" name="domains" value="NetBSD.org"><input type="hidden" name="sitesearch" value="www.NetBSD.org"><input type="submit" value="Search">
1.34      dsieger    38: </form></div></div>
                     39: </div>
                     40: <div class="navBar">
1.37      dsieger    41: <span class="doNotDisplay">
                     42:          Navigation:
                     43:        </span><a href="../">
                     44:          Home</a> | 
                     45:        <a href="../about/">
                     46:          About</a> | 
1.42      hubertf    47:        <a href="../gallery/">
                     48:          Gallery</a> | 
1.37      dsieger    49:        <a href="../releases/">
                     50:          Download</a> | 
                     51:        <a href="../docs/">
                     52:          Documentation</a> | 
                     53:        <a href="../support/">
                     54:          Support</a> | 
                     55:        <a href="../community/">
                     56:          Community</a> | 
                     57:        <a href="../ports/">
                     58:          Ports</a>
1.34      dsieger    59: </div>
                     60: </div>
                     61: <div id="content"><div class="fullWidth"><div class="rowOfBoxes">
                     62: <h1>NetBSD Commit Guidelines</h1>
1.47    ! spz        63: <div class="sect1" lang="en">
1.12      wiz        64: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.1       jschauma   65: <a name="guidelines"></a>
                     66:   The following Commit Guidelines define the Project's standards for making
                     67:   commits to the source tree:
1.12      wiz        68: </h2></div></div></div>
1.1       jschauma   69: 
                     70: 
                     71: 
1.47    ! spz        72: <div class="orderedlist"><ol type="1">
        !            73: <li>
        !            74:     <div class="sect2" lang="en">
1.12      wiz        75: <div class="titlepage"><div><div><h3 class="title">
                     76: <a name="know-thy-code"></a>Commit only code you are familiar with.</h3></div></div></div>
1.1       jschauma   77:       
                     78:       <p>
                     79:         If you are not sure if the code you plan to commit is acceptable
                     80:         (e. g. when taking code that was submitted with a problem report),
                     81:        ask a developer who is familiar with that part of the system for
                     82:        review. If you're new to the Project, check with your sponsor.
                     83:       </p>
                     84:     </div>
                     85:    </li>
1.47    ! spz        86: <li>
        !            87:     <div class="sect2" lang="en">
1.12      wiz        88: <div class="titlepage"><div><div><h3 class="title">
                     89: <a name="tainted"></a>Do not commit tainted code to the repository.</h3></div></div></div>
1.1       jschauma   90:       
                     91:       <p>
                     92:        If you commit code that was not written by yourself, double check
                     93:        that the license on that code permits import into the NetBSD source
                     94:        repository, and permits free distribution. Check with the author(s)
                     95:        of the code, make sure that they were the sole author of the code
                     96:        and verify with them that they did not copy any other code.
                     97:       </p>
                     98:     </div>
                     99:    </li>
1.47    ! spz       100: <li>
        !           101:     <div class="sect2" lang="en">
1.12      wiz       102: <div class="titlepage"><div><div><h3 class="title">
1.29      jschauma  103: <a name="repository"></a>Do not commit code from foreign trees.</h3></div></div></div>
                    104:       
                    105:       <p>
                    106:        Do not commit code from a tree checked out from anywhere but from
                    107:        cvs.NetBSD.org.  Note that all developers have access to the private
1.41      dsieger   108:        <a class="ulink" href="restricted.html#rsync" target="_top">rsync-over-ssh service on
1.29      jschauma  109:        cvs.NetBSD.org</a>.
                    110:       </p>
                    111:     </div>
                    112:    </li>
1.47    ! spz       113: <li>
        !           114:     <div class="sect2" lang="en">
1.29      jschauma  115: <div class="titlepage"><div><div><h3 class="title">
1.1       jschauma  116: <a name="intrusive"></a>
                    117:        The more intrusive your changes are the higher is the level of
                    118:        required prior approval.
1.12      wiz       119:       </h3></div></div></div>
1.1       jschauma  120:       
1.47    ! spz       121:       <div class="itemizedlist"><ul type="disc">
        !           122: <li>
1.1       jschauma  123:           <p>
                    124:            "Obvious" fixes can be committed without any prior discussion
                    125:            or review. (The definition of "obvious" in the GCC Project is:
                    126:            "could not possibly cause anyone to object." We adopt this
                    127:            definition here)
                    128:          </p>
                    129:        </li>
1.47    ! spz       130: <li>
1.1       jschauma  131:          <p>
                    132:            All other (i. e. "non-obvious") fixes <span class="emphasis"><em>should</em></span>
                    133:            have a review.
                    134:          </p>
                    135:        </li>
1.47    ! spz       136: <li>
1.1       jschauma  137:          <p>
                    138:            Implementing (significant) new features requires a prior
                    139:            discussion on an appropriate technical mailing list.
                    140:          </p>
                    141:        </li>
1.47    ! spz       142: <li>
1.1       jschauma  143:          <p>
1.46      pooka     144:            Adding a completely new package (e.g. openldap) requires
                    145:            prior discussion on a mailing list <span class="emphasis"><em>and</em></span>
                    146:            approval from core.
1.1       jschauma  147:          </p>
                    148:        </li>
                    149: </ul></div>
                    150:     </div>
                    151:    </li>
1.47    ! spz       152: <li>
        !           153:     <div class="sect2" lang="en">
1.12      wiz       154: <div class="titlepage"><div><div><h3 class="title">
                    155: <a name="tested"></a>Commit only code that you have tested.</h3></div></div></div>
1.1       jschauma  156:       
                    157:        <p>
                    158:          Make sure that your code actually works as expected, by
                    159:          compiling and running the code that is affected by your change
                    160:          with your system's tools. If you changed a man page, make sure
                    161:          that groff/nroff creates the formatted man page you expect.
                    162:        </p>
                    163:        <p>
                    164:          For normal commits (to the trunk), test that your code works
1.31      kano      165:          on -current. Prior to requesting a pull-up to a branch, test
1.1       jschauma  166:          the very changes you will request from releng on the respective
                    167:          release branch.
                    168:        </p>
1.45      pooka     169:        <p>
                    170:          Run all relevant tests from
                    171:          <code class="filename">/usr/tests</code> or
                    172:          ideally the whole test suite.  The logs of the automated
                    173:          test runs are currently available
                    174:          <a class="ulink" href="http://www.gson.org/netbsd/bugs/build/" target="_top">here</a>.
                    175:          Long-term regressions (build breakage or failing tests)
                    176:          are not acceptable and changes causing such will be backed
                    177:          out if the regressions are not addressed.
                    178:        </p>
1.1       jschauma  179:      </div>
                    180:     </li>
1.47    ! spz       181: <li>
        !           182:       <div class="sect2" lang="en">
1.12      wiz       183: <div class="titlepage"><div><div><h3 class="title">
                    184: <a name="group"></a>Group commits together that are part of the same fix.</h3></div></div></div>
1.1       jschauma  185:        
                    186:        <p>
                    187:          Rototilling a make variable that affects 50 Makefiles should get
                    188:           one commit for all of them together.
                    189:        </p>
                    190:       </div>
                    191:     </li>
1.47    ! spz       192: <li>
        !           193:       <div class="sect2" lang="en">
1.12      wiz       194: <div class="titlepage"><div><div><h3 class="title">
                    195: <a name="separate"></a>Each commit should be a separate patch/fix/addition/etc.</h3></div></div></div>
1.1       jschauma  196:        
                    197:        <p>
                    198:          Don't fix 3 bugs with the same commit and roll that into
                    199:          "Fixed some bugs". Fix one, test, commit, rinse, repeat. This
                    200:          makes life infinitely easier for releng to pull up fixes since
                    201:          often not everything applies to a given branch.
                    202:        </p>
                    203:       </div>
                    204:     </li>
1.47    ! spz       205: <li>
        !           206:       <div class="sect2" lang="en">
1.12      wiz       207: <div class="titlepage"><div><div><h3 class="title">
1.1       jschauma  208: <a name="dont-mix"></a>
                    209:          Do not mix functionality or bug-fix patches with
                    210:          whitespace/layout updates.
1.12      wiz       211:        </h3></div></div></div>
1.1       jschauma  212:        
                    213:         <p>
                    214:          Do those separately (apart from the general requirement that
                    215:          changes be made in such a way that it is easy to discern what
                    216:          each fix did, as described in item 6, there will be pullup
                    217:          issues with largely changed files from trunk-&gt;branch when
                    218:          mixing whitespace with functionality fixes).
                    219:        </p>
                    220:       </div>
                    221:     </li>
1.47    ! spz       222: <li>
        !           223:       <div class="sect2" lang="en">
1.12      wiz       224: <div class="titlepage"><div><div><h3 class="title">
1.46      pooka     225: <a name="document"></a>Clearly document the reasons for your changes in
                    226:               the commit log.</h3></div></div></div>
1.1       jschauma  227:        
                    228:        <p>
1.46      pooka     229:          Detail to some degree what was changed and why.  This
                    230:          doesn't need to be a code review/walkthrough but it should
                    231:          be informative to someone reading the log and looking
                    232:          over the diff in 6 months.  The focus should be on "why"
                    233:          since the target audience reading the logs can usually
                    234:          figure out "what" from looking the diffs.  As an exercise,
                    235:          consider the difference of usefulness between "set i to
                    236:          1" and "initialize iterator correctly to fix a rarely
                    237:          triggering bug in memory handling".
                    238:        </p>
                    239: 
                    240:        <p>
                    241:          Also, "fixed some stuff" or "cvs-1.10.0" isn't informative
                    242:          whereas the following example is:
1.1       jschauma  243:        </p>
                    244:        <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
                    245: <h3 class="title"></h3>
                    246:           "Print useful line number on error while executing .for directive."
                    247:         </div>
                    248:        <p>
1.32      heinz     249:          If your change fixes a PR, document it with an appropriate
1.47    ! spz       250:          message. Using the template &#8220;<span class="quote">PR category/bug-id</span>&#8221; in
1.32      heinz     251:          your commit message will also append it to the respective problem
                    252:          report in our bug database:
1.1       jschauma  253:        </p>
                    254:        <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
                    255: <h3 class="title"></h3>
                    256:           "Closes PR bin/6666"
                    257:         </div>
                    258:        <p>
                    259:          If your code has been reviewed by someone else, document this:
                    260:        </p>
                    261:        <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
                    262: <h3 class="title"></h3>
                    263:           "Reviewed by &lt;mrg&gt;"
                    264:        </div>
                    265:        <p>
                    266:          (Please note that a good commit log doesn't relieve the need
                    267:          for good documentation in the program itself.)
                    268:        </p>
                    269:       </div>
                    270:     </li>
1.47    ! spz       271: <li>
        !           272:       <div class="sect2" lang="en">
1.12      wiz       273: <div class="titlepage"><div><div><h3 class="title">
                    274: <a name="credit"></a>Give proper credit.</h3></div></div></div>
1.1       jschauma  275:        
                    276:        <p>
                    277:          If you commit code that had been submitted in a PR, give
                    278:          proper credit, like:
                    279:        </p>
                    280:        <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
                    281: <h3 class="title"></h3>
                    282:            "Code submitted in PR lib/393939 by Joe Doe"
                    283:        </div>
                    284:        <p>
                    285:          Since the commit messages will eventually appear on the
                    286:          source-changes mailing list which is also available via web,
                    287:          specifying the e-mail addresses of the PR submitter should
                    288:          generally be avoided.
                    289:        </p>
                    290:        <p>
                    291:          If you took code from an other Open Source Project, give
                    292:          credit, like:
                    293:        </p>
                    294:        <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
                    295: <h3 class="title"></h3>
                    296:           "From FreeBSD"
                    297:        </div>
                    298:       </div>
                    299:     </li>
1.47    ! spz       300: <li>
        !           301:       <div class="sect2" lang="en">
1.12      wiz       302: <div class="titlepage"><div><div><h3 class="title">
                    303: <a name="revert"></a>Do not revert other developer's commits.</h3></div></div></div>
1.1       jschauma  304:        
                    305:        <p>
                    306:          If you do not agree with another developer's commit, do not
                    307:          revert it on your own. Contact the other developer and explain
1.47    ! spz       308:          to him or her the issues you have with the commit in question.
        !           309:           Ask the other developer to back out the changes instead of
        !           310:           doing it yourself.
1.1       jschauma  311:        </p>
                    312:        <p>
                    313:          If no agreement can be reached, contact the Technical
                    314:          Executive Committee &lt;technical-exec@NetBSD.org&gt;, which
                    315:          will serve as mediation authority.
                    316:        </p>
                    317:       </div>
                    318:   </li>
                    319: </ol></div>
                    320: 
                    321: </div>
1.34      dsieger   322: </div></div></div>
                    323: <div class="navfoot"></div>
1.43      mishka    324: <div id="footer"><div id="footerContent"><center>
1.34      dsieger   325: <span class="footfeed"><a href="http://www.NetBSD.org/cgi-bin/feedback.cgi">
                    326:          Contact</a> |
1.40      kano      327:       </span><span class="footcopy"><a href="../about/disclaimer.html">
1.34      dsieger   328:       Disclaimer</a> |
1.1       jschauma  329: 
1.44      tonnerre  330:       <span class="copyright">Copyright © 1994-2010 The NetBSD Foundation, Inc. </span>ALL RIGHTS RESERVED.<br>NetBSD<sup>®</sup> is a registered trademark of The NetBSD
1.34      dsieger   331:        Foundation, Inc.</span>
1.43      mishka    332: </center></div></div>
1.1       jschauma  333: </div></body>
                    334: </html>

CVSweb <webmaster@jp.NetBSD.org>