1*84e872a0SLloyd PiqueContributing to Wayland 2*84e872a0SLloyd Pique======================= 3*84e872a0SLloyd Pique 4*84e872a0SLloyd PiqueSending patches 5*84e872a0SLloyd Pique--------------- 6*84e872a0SLloyd Pique 7*84e872a0SLloyd PiquePatches should be sent via 8*84e872a0SLloyd Pique[GitLab merge requests](https://docs.gitlab.com/ce/gitlab-basics/add-merge-request.html). 9*84e872a0SLloyd PiqueWayland is 10*84e872a0SLloyd Pique[hosted on freedesktop.org's GitLab](https://gitlab.freedesktop.org/wayland/wayland/): 11*84e872a0SLloyd Piquein order to submit code, you should create an account on this GitLab instance, 12*84e872a0SLloyd Piquefork the core Wayland repository, push your changes to a branch in your new 13*84e872a0SLloyd Piquerepository, and then submit these patches for review through a merge request. 14*84e872a0SLloyd Pique 15*84e872a0SLloyd PiqueWayland formerly accepted patches via `git-send-email`, sent to 16*84e872a0SLloyd Pique**[email protected]**; these were 17*84e872a0SLloyd Pique[tracked using Patchwork](https://patchwork.freedesktop.org/project/wayland/). 18*84e872a0SLloyd PiqueSome old patches continue to be sent this way, and we may accept small new 19*84e872a0SLloyd Piquepatches sent to the list, but please send all new patches through GitLab merge 20*84e872a0SLloyd Piquerequests. 21*84e872a0SLloyd Pique 22*84e872a0SLloyd Pique 23*84e872a0SLloyd PiqueFormatting and separating commits 24*84e872a0SLloyd Pique--------------------------------- 25*84e872a0SLloyd Pique 26*84e872a0SLloyd PiqueUnlike many projects using GitHub and GitLab, Wayland has a 27*84e872a0SLloyd Pique[linear, 'recipe' style history](http://www.bitsnbites.eu/git-history-work-log-vs-recipe/). 28*84e872a0SLloyd PiqueThis means that every commit should be small, digestible, stand-alone, and 29*84e872a0SLloyd Piquefunctional. Rather than a purely chronological commit history like this: 30*84e872a0SLloyd Pique 31*84e872a0SLloyd Pique connection: plug a fd leak 32*84e872a0SLloyd Pique plug another fd leak 33*84e872a0SLloyd Pique connection: init fds to -1 34*84e872a0SLloyd Pique close all fds 35*84e872a0SLloyd Pique refactor checks into a new function 36*84e872a0SLloyd Pique don't close fds we handed out 37*84e872a0SLloyd Pique 38*84e872a0SLloyd Piquewe aim to have a clean history which only reflects the final state, broken up 39*84e872a0SLloyd Piqueinto functional groupings: 40*84e872a0SLloyd Pique 41*84e872a0SLloyd Pique connection: Refactor out closure allocation 42*84e872a0SLloyd Pique connection: Clear fds we shouldn't close to -1 43*84e872a0SLloyd Pique connection: Make wl_closure_destroy() close fds of undispatched closures 44*84e872a0SLloyd Pique 45*84e872a0SLloyd PiqueThis ensures that the final patch series only contains the final state, 46*84e872a0SLloyd Piquewithout the changes and missteps taken along the development process. 47*84e872a0SLloyd Pique 48*84e872a0SLloyd PiqueThe first line of a commit message should contain a prefix indicating 49*84e872a0SLloyd Piquewhat part is affected by the patch followed by one sentence that 50*84e872a0SLloyd Piquedescribes the change. For examples: 51*84e872a0SLloyd Pique 52*84e872a0SLloyd Pique protocol: Support scaled outputs and surfaces 53*84e872a0SLloyd Pique 54*84e872a0SLloyd Piqueand 55*84e872a0SLloyd Pique 56*84e872a0SLloyd Pique doc: generate server documentation from XML too 57*84e872a0SLloyd Pique 58*84e872a0SLloyd PiqueIf in doubt what prefix to use, look at other commits that change the 59*84e872a0SLloyd Piquesame file(s) as the patch being sent. 60*84e872a0SLloyd Pique 61*84e872a0SLloyd PiqueThe body of the commit message should describe what the patch changes 62*84e872a0SLloyd Piqueand why, and also note any particular side effects. This shouldn't be 63*84e872a0SLloyd Piqueempty on most of the cases. It shouldn't take a lot of effort to write 64*84e872a0SLloyd Piquea commit message for an obvious change, so an empty commit message 65*84e872a0SLloyd Piquebody is only acceptable if the questions "What?" and "Why?" are already 66*84e872a0SLloyd Piqueanswered on the one-line summary. 67*84e872a0SLloyd Pique 68*84e872a0SLloyd PiqueThe lines of the commit message should have at most 76 characters, to 69*84e872a0SLloyd Piquecope with the way git log presents them. 70*84e872a0SLloyd Pique 71*84e872a0SLloyd PiqueSee [notes on commit messages] for a recommended reading on writing commit 72*84e872a0SLloyd Piquemessages. 73*84e872a0SLloyd Pique 74*84e872a0SLloyd PiqueYour patches should also include a Signed-off-by line with your name and 75*84e872a0SLloyd Piqueemail address. If you're not the patch's original author, you should 76*84e872a0SLloyd Piquealso gather S-o-b's by them (and/or whomever gave the patch to you.) The 77*84e872a0SLloyd Piquesignificance of this is that it certifies that you created the patch, 78*84e872a0SLloyd Piquethat it was created under an appropriate open source license, or 79*84e872a0SLloyd Piqueprovided to you under those terms. This lets us indicate a chain of 80*84e872a0SLloyd Piqueresponsibility for the copyright status of the code. 81*84e872a0SLloyd Pique 82*84e872a0SLloyd PiqueWe won't reject patches that lack S-o-b, but it is strongly recommended. 83*84e872a0SLloyd Pique 84*84e872a0SLloyd PiqueWhen you re-send patches, revised or not, it would be very good to document the 85*84e872a0SLloyd Piquechanges compared to the previous revision in the commit message and/or the 86*84e872a0SLloyd Piquemerge request. If you have already received Reviewed-by or Acked-by tags, you 87*84e872a0SLloyd Piqueshould evaluate whether they still apply and include them in the respective 88*84e872a0SLloyd Piquecommit messages. Otherwise the tags may be lost, reviewers miss the credit they 89*84e872a0SLloyd Piquedeserve, and the patches may cause redundant review effort. 90*84e872a0SLloyd Pique 91*84e872a0SLloyd Pique 92*84e872a0SLloyd PiqueTracking patches and following up 93*84e872a0SLloyd Pique--------------------------------- 94*84e872a0SLloyd Pique 95*84e872a0SLloyd PiqueOnce submitted to GitLab, your patches will be reviewed by the Wayland 96*84e872a0SLloyd Piquedevelopment team on GitLab. Review may be entirely positive and result in your 97*84e872a0SLloyd Piquecode landing instantly, in which case, great! You're done. However, we may ask 98*84e872a0SLloyd Piqueyou to make some revisions: fixing some bugs we've noticed, working to a 99*84e872a0SLloyd Piqueslightly different design, or adding documentation and tests. 100*84e872a0SLloyd Pique 101*84e872a0SLloyd PiqueIf you do get asked to revise the patches, please bear in mind the notes above. 102*84e872a0SLloyd PiqueYou should use `git rebase -i` to make revisions, so that your patches follow 103*84e872a0SLloyd Piquethe clear linear split documented above. Following that split makes it easier 104*84e872a0SLloyd Piquefor reviewers to understand your work, and to verify that the code you're 105*84e872a0SLloyd Piquesubmitting is correct. 106*84e872a0SLloyd Pique 107*84e872a0SLloyd PiqueA common request is to split single large patch into multiple patches. This can 108*84e872a0SLloyd Piquehappen, for example, if when adding a new feature you notice a bug elsewhere 109*84e872a0SLloyd Piquewhich you need to fix to progress. Separating these changes into separate 110*84e872a0SLloyd Piquecommits will allow us to verify and land the bugfix quickly, pushing part of 111*84e872a0SLloyd Piqueyour work for the good of everyone, whilst revision and discussion continues on 112*84e872a0SLloyd Piquethe larger feature part. It also allows us to direct you towards reviewers who 113*84e872a0SLloyd Piquebest understand the different areas you are working on. 114*84e872a0SLloyd Pique 115*84e872a0SLloyd PiqueWhen you have made any requested changes, please rebase the commits, verify 116*84e872a0SLloyd Piquethat they still individually look good, then force-push your new branch to 117*84e872a0SLloyd PiqueGitLab. This will update the merge request and notify everyone subscribed to 118*84e872a0SLloyd Piqueyour merge request, so they can review it again. 119*84e872a0SLloyd Pique 120*84e872a0SLloyd PiqueThere are also 121*84e872a0SLloyd Pique[many GitLab CLI clients](https://about.gitlab.com/applications/#cli-clients), 122*84e872a0SLloyd Piqueif you prefer to avoid the web interface. It may be difficult to follow review 123*84e872a0SLloyd Piquecomments without using the web interface though, so we do recommend using this 124*84e872a0SLloyd Piqueto go through the review process, even if you use other clients to track the 125*84e872a0SLloyd Piquelist of available patches. 126*84e872a0SLloyd Pique 127*84e872a0SLloyd Pique 128*84e872a0SLloyd PiqueCoding style 129*84e872a0SLloyd Pique------------ 130*84e872a0SLloyd Pique 131*84e872a0SLloyd PiqueYou should follow the style of the file you're editing. In general, we 132*84e872a0SLloyd Piquetry to follow the rules below. 133*84e872a0SLloyd Pique 134*84e872a0SLloyd Pique**Note: this file uses spaces due to markdown rendering issues for tabs. 135*84e872a0SLloyd Pique Code must be implemented using tabs.** 136*84e872a0SLloyd Pique 137*84e872a0SLloyd Pique- indent with tabs, and a tab is always 8 characters wide 138*84e872a0SLloyd Pique- opening braces are on the same line as the if statement; 139*84e872a0SLloyd Pique- no braces in an if-body with just one statement; 140*84e872a0SLloyd Pique- if one of the branches of an if-else condition has braces, then the 141*84e872a0SLloyd Pique other branch should also have braces; 142*84e872a0SLloyd Pique- there is always an empty line between variable declarations and the 143*84e872a0SLloyd Pique code; 144*84e872a0SLloyd Pique 145*84e872a0SLloyd Pique```c 146*84e872a0SLloyd Piquestatic int 147*84e872a0SLloyd Piquemy_function(void) 148*84e872a0SLloyd Pique{ 149*84e872a0SLloyd Pique int a = 0; 150*84e872a0SLloyd Pique 151*84e872a0SLloyd Pique if (a) 152*84e872a0SLloyd Pique b(); 153*84e872a0SLloyd Pique else 154*84e872a0SLloyd Pique c(); 155*84e872a0SLloyd Pique 156*84e872a0SLloyd Pique if (a) { 157*84e872a0SLloyd Pique b(); 158*84e872a0SLloyd Pique c(); 159*84e872a0SLloyd Pique } else { 160*84e872a0SLloyd Pique d(); 161*84e872a0SLloyd Pique } 162*84e872a0SLloyd Pique} 163*84e872a0SLloyd Pique``` 164*84e872a0SLloyd Pique 165*84e872a0SLloyd Pique- lines should be less than 80 characters wide; 166*84e872a0SLloyd Pique- when breaking lines with functions calls, the parameters are aligned 167*84e872a0SLloyd Pique with the opening parentheses; 168*84e872a0SLloyd Pique- when assigning a variable with the result of a function call, if the 169*84e872a0SLloyd Pique line would be longer we break it around the equal '=' sign if it makes 170*84e872a0SLloyd Pique sense; 171*84e872a0SLloyd Pique 172*84e872a0SLloyd Pique```c 173*84e872a0SLloyd Pique long_variable_name = 174*84e872a0SLloyd Pique function_with_a_really_long_name(parameter1, parameter2, 175*84e872a0SLloyd Pique parameter3, parameter4); 176*84e872a0SLloyd Pique 177*84e872a0SLloyd Pique x = function_with_a_really_long_name(parameter1, parameter2, 178*84e872a0SLloyd Pique parameter3, parameter4); 179*84e872a0SLloyd Pique``` 180*84e872a0SLloyd Pique 181*84e872a0SLloyd PiqueConduct 182*84e872a0SLloyd Pique======= 183*84e872a0SLloyd Pique 184*84e872a0SLloyd PiqueAs a freedesktop.org project, Wayland follows the Contributor Covenant, 185*84e872a0SLloyd Piquefound at: 186*84e872a0SLloyd Piquehttps://www.freedesktop.org/wiki/CodeOfConduct 187*84e872a0SLloyd Pique 188*84e872a0SLloyd PiquePlease conduct yourself in a respectful and civilised manner when 189*84e872a0SLloyd Piqueinteracting with community members on mailing lists, IRC, or bug 190*84e872a0SLloyd Piquetrackers. The community represents the project as a whole, and abusive 191*84e872a0SLloyd Piqueor bullying behaviour is not tolerated by the project. 192*84e872a0SLloyd Pique 193*84e872a0SLloyd Pique 194*84e872a0SLloyd PiqueLicensing 195*84e872a0SLloyd Pique========= 196*84e872a0SLloyd Pique 197*84e872a0SLloyd PiqueWayland is licensed with the intention to be usable anywhere X.org is. 198*84e872a0SLloyd PiqueOriginally, X.org was covered under the MIT X11 license, but changed to 199*84e872a0SLloyd Piquethe MIT Expat license. Similarly, Wayland was covered initially as MIT 200*84e872a0SLloyd PiqueX11 licensed, but changed to the MIT Expat license, following in X.org's 201*84e872a0SLloyd Piquefootsteps. Other than wording, the two licenses are substantially the 202*84e872a0SLloyd Piquesame, with the exception of a no-advertising clause in X11 not included 203*84e872a0SLloyd Piquein Expat. 204*84e872a0SLloyd Pique 205*84e872a0SLloyd PiqueNew source code files should specify the MIT Expat license in their 206*84e872a0SLloyd Piqueboilerplate, as part of the copyright statement. 207*84e872a0SLloyd Pique 208*84e872a0SLloyd Pique 209*84e872a0SLloyd PiqueReview 210*84e872a0SLloyd Pique====== 211*84e872a0SLloyd Pique 212*84e872a0SLloyd PiqueAll patches, even trivial ones, require at least one positive review 213*84e872a0SLloyd Pique(Reviewed-by). Additionally, if no Reviewed-by's have been given by 214*84e872a0SLloyd Piquepeople with commit access, there needs to be at least one Acked-by from 215*84e872a0SLloyd Piquesomeone with commit access. A person with commit access is expected to be 216*84e872a0SLloyd Piqueable to evaluate the patch with respect to the project scope and architecture. 217*84e872a0SLloyd Pique 218*84e872a0SLloyd PiqueThe below review guidelines are intended to be interpreted in spirit, not by 219*84e872a0SLloyd Piquethe letter. There may be circumstances where some guidelines are better 220*84e872a0SLloyd Piqueignored. We rely very much on the judgement of reviewers and commit rights 221*84e872a0SLloyd Piqueholders. 222*84e872a0SLloyd Pique 223*84e872a0SLloyd PiqueDuring review, the following matters should be checked: 224*84e872a0SLloyd Pique 225*84e872a0SLloyd Pique- The commit message explains why the change is being made. 226*84e872a0SLloyd Pique 227*84e872a0SLloyd Pique- The code fits the project's scope. 228*84e872a0SLloyd Pique 229*84e872a0SLloyd Pique- The code license is the same MIT licence the project generally uses. 230*84e872a0SLloyd Pique 231*84e872a0SLloyd Pique- Stable ABI or API is not broken. 232*84e872a0SLloyd Pique 233*84e872a0SLloyd Pique- Stable ABI or API additions must be justified by actual use cases, not only 234*84e872a0SLloyd Piqueby speculation. They must also be documented, and it is strongly recommended to 235*84e872a0SLloyd Piqueinclude tests exercising the additions in the test suite. 236*84e872a0SLloyd Pique 237*84e872a0SLloyd Pique- The code fits the existing software architecture, e.g. no layering 238*84e872a0SLloyd Piqueviolations. 239*84e872a0SLloyd Pique 240*84e872a0SLloyd Pique- The code is correct and does not introduce new failures for existing users, 241*84e872a0SLloyd Piquedoes not add new corner-case bugs, and does not introduce new compiler 242*84e872a0SLloyd Piquewarnings. 243*84e872a0SLloyd Pique 244*84e872a0SLloyd Pique- The patch does what it says in the commit message and changes nothing else. 245*84e872a0SLloyd Pique 246*84e872a0SLloyd Pique- The patch is a single logical change. If the commit message addresses 247*84e872a0SLloyd Piquemultiple points, it is a hint that the commit might need splitting up. 248*84e872a0SLloyd Pique 249*84e872a0SLloyd Pique- A bug fix should target the underlying root cause instead of hiding symptoms. 250*84e872a0SLloyd PiqueIf a complete fix is not practical, partial fixes are acceptable if they come 251*84e872a0SLloyd Piquewith code comments and filed Gitlab issues for the remaining bugs. 252*84e872a0SLloyd Pique 253*84e872a0SLloyd Pique- The bug root cause rule applies to external software components as well, e.g. 254*84e872a0SLloyd Piquedo not work around kernel driver issues in userspace. 255*84e872a0SLloyd Pique 256*84e872a0SLloyd Pique- The test suite passes. 257*84e872a0SLloyd Pique 258*84e872a0SLloyd Pique- The code does not depend on API or ABI which has no working free open source 259*84e872a0SLloyd Piqueimplementation. 260*84e872a0SLloyd Pique 261*84e872a0SLloyd Pique- The code is not dead or untestable. E.g. if there are no free open source 262*84e872a0SLloyd Piquesoftware users for it then it is effectively dead code. 263*84e872a0SLloyd Pique 264*84e872a0SLloyd Pique- The code is written to be easy to understand, or if code cannot be clear 265*84e872a0SLloyd Piqueenough on its own there are code comments to explain it. 266*84e872a0SLloyd Pique 267*84e872a0SLloyd Pique- The code is minimal, i.e. prefer refactor and re-use when possible unless 268*84e872a0SLloyd Piqueclarity suffers. 269*84e872a0SLloyd Pique 270*84e872a0SLloyd Pique- The code adheres to the style guidelines. 271*84e872a0SLloyd Pique 272*84e872a0SLloyd Pique- In a patch series, every intermediate step adheres to the above guidelines. 273*84e872a0SLloyd Pique 274*84e872a0SLloyd Pique 275*84e872a0SLloyd PiqueCommit rights 276*84e872a0SLloyd Pique============= 277*84e872a0SLloyd Pique 278*84e872a0SLloyd PiqueCommit rights will be granted to anyone who requests them and fulfills the 279*84e872a0SLloyd Piquebelow criteria: 280*84e872a0SLloyd Pique 281*84e872a0SLloyd Pique- Submitted some (10 as a rule of thumb) non-trivial (not just simple 282*84e872a0SLloyd Pique spelling fixes and whitespace adjustment) patches that have been merged 283*84e872a0SLloyd Pique already. 284*84e872a0SLloyd Pique 285*84e872a0SLloyd Pique- Are actively participating in public discussions about their work (on the 286*84e872a0SLloyd Pique mailing list or IRC). This should not be interpreted as a requirement to 287*84e872a0SLloyd Pique review other peoples patches but just make sure that patch submission isn't 288*84e872a0SLloyd Pique one-way communication. Cross-review is still highly encouraged. 289*84e872a0SLloyd Pique 290*84e872a0SLloyd Pique- Will be regularly contributing further patches. This includes regular 291*84e872a0SLloyd Pique contributors to other parts of the open source graphics stack who only 292*84e872a0SLloyd Pique do the occasional development in this project. 293*84e872a0SLloyd Pique 294*84e872a0SLloyd Pique- Agrees to use their commit rights in accordance with the documented merge 295*84e872a0SLloyd Pique criteria, tools, and processes. 296*84e872a0SLloyd Pique 297*84e872a0SLloyd PiqueTo apply for commit rights, create a new issue in gitlab for the respective 298*84e872a0SLloyd Piqueproject and give it the "accounts" label. 299*84e872a0SLloyd Pique 300*84e872a0SLloyd PiqueCommitters are encouraged to request their commit rights get removed when they 301*84e872a0SLloyd Piqueno longer contribute to the project. Commit rights will be reinstated when they 302*84e872a0SLloyd Piquecome back to the project. 303*84e872a0SLloyd Pique 304*84e872a0SLloyd PiqueMaintainers and committers should encourage contributors to request commit 305*84e872a0SLloyd Piquerights, especially junior contributors tend to underestimate their skills. 306*84e872a0SLloyd Pique 307*84e872a0SLloyd Pique 308*84e872a0SLloyd PiqueStabilising for releases 309*84e872a0SLloyd Pique======================== 310*84e872a0SLloyd Pique 311*84e872a0SLloyd PiqueA release cycle ends with a stable release which also starts a new cycle and 312*84e872a0SLloyd Piquelifts any code freezes. Gradual code freezing towards a stable release starts 313*84e872a0SLloyd Piquewith an alpha release. The release stages of a cycle are: 314*84e872a0SLloyd Pique 315*84e872a0SLloyd Pique- **Alpha release**: 316*84e872a0SLloyd Pique Signified by version number #.#.91. 317*84e872a0SLloyd Pique Major features must have landed before this. Major features include 318*84e872a0SLloyd Pique invasive code motion and refactoring, high risk changes, and new stable 319*84e872a0SLloyd Pique library ABI. 320*84e872a0SLloyd Pique 321*84e872a0SLloyd Pique- **Beta release**: 322*84e872a0SLloyd Pique Signified by version number #.#.92. 323*84e872a0SLloyd Pique Minor features must have landed before this. Minor features include all 324*84e872a0SLloyd Pique new features that are not major, low risk changes, clean-ups, and 325*84e872a0SLloyd Pique documentation. Stable ABI that was new in the alpha release can be removed 326*84e872a0SLloyd Pique before a beta release if necessary. 327*84e872a0SLloyd Pique 328*84e872a0SLloyd Pique- **Release candidates (RC)**: 329*84e872a0SLloyd Pique Signified by version number #.#.93 and up to #.#.99. 330*84e872a0SLloyd Pique Bug fixes that are not release critical must have landed before this. 331*84e872a0SLloyd Pique Release critical bug fixes can still be landed after this, but they may 332*84e872a0SLloyd Pique call for another RC. 333*84e872a0SLloyd Pique 334*84e872a0SLloyd Pique- **Stable release**: 335*84e872a0SLloyd Pique Signified by version number #.#.0. 336*84e872a0SLloyd Pique Ideally no changes since the last RC. 337*84e872a0SLloyd Pique 338*84e872a0SLloyd PiqueMind that version #.#.90 is never released. It is used during development when 339*84e872a0SLloyd Piqueno code freeze is in effect. Stable branches and point releases are not covered 340*84e872a0SLloyd Piqueby the above. 341*84e872a0SLloyd Pique 342*84e872a0SLloyd Pique 343*84e872a0SLloyd Pique[git documentation]: http://git-scm.com/documentation 344*84e872a0SLloyd Pique[notes on commit messages]: http://who-t.blogspot.de/2009/12/on-commit-messages.html 345