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