3 We'd love to accept your patches and contributions to Pigweed. There are just a
4 few small guidelines you need to follow. Before making or sending major changes,
5 please reach out on the [mailing list](mailto:pigweed@googlegroups.com) first to
6 ensure the changes make sense for upstream. We generally go through a design
7 phase before making large changes.
9 Before participating in our community, please take a moment to review our [code
10 of conduct](CODE_OF_CONDUCT.md). We expect everyone who interacts with the
11 project to respect these guidelines.
13 Pigweed contribution overview:
14 1. One-time contributor setup:
15 * Sign the [Contributor License Agreement](https://cla.developers.google.com/).
16 * Verify that Git user email (git config user.email) is either Google Account
17 email or an Alternate email for the Google account used to sign the CLA (Manage
18 Google account->Personal Info->email).
19 * Install the [Gerrit commit hook](CONTRIBUTING.md#gerrit-commit-hook) to
20 automatically add a `Change-Id: ...` line to your commit.
21 * Install the Pigweed presubmit check hook (`pw presubmit --install`).
23 1. Ensure all files include a correct [copyright and license header](CONTRIBUTING.md#source-code-headers).
24 1. Run `pw presubmit` (see below) to detect style or compilation issues before
26 1. Upload the change with `git push origin HEAD:refs/for/master`.
27 1. Address any reviewer feedback by amending the commit (`git commit --amend`).
28 1. Submit change to CI builders to merge. If you are not part of Pigweed's
29 core team, you can ask the reviewer to add the `+2 CQ` vote, which will
30 trigger a rebase asd submit once the builders pass.
32 ## Contributor License Agreement
34 Contributions to this project must be accompanied by a Contributor License
35 Agreement. You (or your employer) retain the copyright to your contribution;
36 this simply gives us permission to use and redistribute your contributions as
37 part of the project. Head over to <https://cla.developers.google.com/> to see
38 your current agreements on file or to sign a new one.
40 You generally only need to submit a CLA once, so if you've already submitted one
41 (even if it was for a different project), you probably don't need to do it
46 Gerrit requires all changes to have a `Change-Id` tag at the bottom of each CL.
47 You should set this up to be done automatically using the instructions below.
51 $ f=`git rev-parse --git-dir`/hooks/commit-msg ; mkdir -p $(dirname $f) ; curl -Lo $f https://gerrit-review.googlesource.com/tools/hooks/commit-msg ; chmod +x $f
55 Download [the Gerrit commit hook](https://gerrit-review.googlesource.com/tools/hooks/commit-msg)
56 and then copy it to the `.git\hooks` directory in the Pigweed repository.
58 copy %HOMEPATH%\Downloads\commit-msg %HOMEPATH%\pigweed\.git\hooks\commit-msg
63 All Pigweed development happens on Gerrit, following the [typical Gerrit
64 development workflow](http://ceres-solver.org/contributing.html). Consult
65 [Gerrit User Guide](https://gerrit-documentation.storage.googleapis.com/Documentation/2.12.3/intro-user.html)
66 for more information on using Gerrit.
68 In the future we may support GitHub pull requests, but until that time we will
69 close GitHub pull requests and ask that the changes be uploaded to Gerrit
72 ## Community Guidelines
74 This project follows [Google's Open Source Community
75 Guidelines](https://opensource.google/conduct/) and the [Pigweed Code of
76 Conduct](CODE_OF_CONDUCT.md).
78 ## Source Code Headers
80 Every Pigweed file containing source code must include copyright and license
81 information. This includes any JS/CSS files that you might be serving out to
84 Apache header for C and C++ files:
87 // Copyright 2020 The Pigweed Authors
89 // Licensed under the Apache License, Version 2.0 (the "License"); you may not
90 // use this file except in compliance with the License. You may obtain a copy of
93 // https://www.apache.org/licenses/LICENSE-2.0
95 // Unless required by applicable law or agreed to in writing, software
96 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
97 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
98 // License for the specific language governing permissions and limitations under
102 Apache header for Python and GN files:
105 # Copyright 2020 The Pigweed Authors
107 # Licensed under the Apache License, Version 2.0 (the "License"); you may not
108 # use this file except in compliance with the License. You may obtain a copy of
111 # https://www.apache.org/licenses/LICENSE-2.0
113 # Unless required by applicable law or agreed to in writing, software
114 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
115 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
116 # License for the specific language governing permissions and limitations under
120 ## Continuous Integration
122 All Pigweed CLs must adhere to Pigweed's style guide and pass a suite of
123 automated builds, tests, and style checks to be merged upstream. Much of this
124 checking is done using Pigweed's pw_presubmit module by automated builders. To
125 speed up the review process, consider adding `pw presubmit` as a git push hook
126 using the following command:
130 $ pw presubmit --install
133 This will be effectively the same as running the following command before every
136 $ pw presubmit --program quick
139 ![pigweed presubmit demonstration](pw_presubmit/docs/pw_presubmit_demo.gif)
141 Running `pw presubmit` manually will default to running the `full` presubmit
144 If you ever need to bypass the presubmit hook (due to it being broken, for example) you
145 may push using this command:
148 $ git push origin HEAD:refs/for/master --no-verify