File: CONTRIBUTING.md

package info (click to toggle)
s390-tools 2.3.0-1
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 6,176 kB
  • sloc: ansic: 87,755; sh: 8,398; cpp: 8,384; perl: 3,783; makefile: 1,476; asm: 654
file content (263 lines) | stat: -rw-r--r-- 8,510 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
Contributing to s390-tools
==========================

License
-------
All contributions have to be submitted under the MIT license. See also
the [LICENSE](LICENSE) file.

Developer's Certificate of Origin and Signed-off-by
---------------------------------------------------
The sign-off is a simple line at the end of the explanation for the patch,
which certifies that you wrote it or otherwise have the right to pass it on as
an open-source patch.

With the Signed-off-by line you certify the below:

```
Developer's Certificate of Origin 1.1

       By making a contribution to this project, I certify that:

       (a) The contribution was created in whole or in part by me and I
           have the right to submit it under the open source license
           indicated in the file; or

       (b) The contribution is based upon previous work that, to the best
           of my knowledge, is covered under an appropriate open source
           license and I have the right under that license to submit that
           work with modifications, whether created in whole or in part
           by me, under the same open source license (unless I am
           permitted to submit under a different license), as indicated
           in the file; or

       (c) The contribution was provided directly to me by some other
           person who certified (a), (b) or (c) and I have not modified
           it.

       (d) I understand and agree that this project and the contribution
           are public and that a record of the contribution (including all
           personal information I submit with it, including my sign-off) is
           maintained indefinitely and may be redistributed consistent with
           this project or the open source license(s) involved.
```

If you can certify the above, just add a line stating the following at the
bottom of each of your commit messages:

```
Signed-off-by: Random Developer <random@developer.example.org>
```

Please use your real name and a valid e-mail address (no pseudonyms or anonymous
contributions).

Submitting code
---------------
The preferred way is to create GitHub pull requests for your code contributions.
Please create separate pull requests for each logical enhancement, new feature,
or fix.

Before you submit your code please consider our recommendations in the
[CODINGSTYLE](CODINGSTYLE.md) document.

GitHub workflow for contributions
---------------------------------
In the examples below we use this fictive identity:

 - Name: Random Developer
 - E-mail: random@developer.example.org
 - GitHub ID: random-developer

### Setup GitHub and local git

1. Create a fork of this repository by clicking the `Fork` button on the top
   right of the [s390-tools](https://github.com/ibm-s390-tools/s390-tools)
   main page

2. Clone your forked repository to your local development system
   ```
   $ git clone https://github.com/random-developer/s390-tools.git
   ```

3. Configure a remote called "upstream" pointing to the official
   s390-tools repository on GitHub
   ```
   $ cd s390-tools
   ~/s390-tools $ git remote add upstream https://github.com/ibm-s390-tools/s390-tools.git
   ```

4. Verify your remotes
   ```
   ~/s390-tools $ git remote -v
   origin  https://github.com/random-developer/s390-tools.git (fetch)
   origin  https://github.com/random-developer/s390-tools.git (push)
   upstream        https://github.com/ibm-s390-tools/s390-tools.git (fetch)
   upstream        https://github.com/ibm-s390-tools/s390-tools.git (push)
   ```
   You now have two remotes: The "origin" remote points to your fork
   and the "upstream" remote to the official s390-tools repository.

5. Configure your git user name and e-mail
   ```
   ~/s390-tools $ git config user.name "Random Developer"
   ~/s390-tools $ git config user.email "random@developer.example.com"
   ```

### Create a pull request

1. Create and checkout a new branch for your contribution
   ```
   ~/s390-tools $ git checkout -b contrib-doc-pr
   ```

2. Make your changes to the code
   ```
   ~/s390-tools $ vim CONTRIBUTING.md
   ```

3. Build and test your contribution
   ```
   ~/s390-tools $ make clean all
   ~/s390-tools $ # Whatever you have to do for testing
   ```

4. Commit your changes
   ```
   ~/s390-tools $ git add CONTRIBUTING.md
   ~/s390-tools $ git commit -s
   ```

   Provide a meaningful commit message including your "Signed-off-by" line to
   each commit:
   ```
   CONTRIBUTING: Outline steps to submit code

   Explain in more detail how to submit s390-tools contributions as GitHub
   pull requests.

   Signed-off-by: Random Developer <random@developer.example.com>
   ```

5. Use the [checkpatch] tool to validate your commits
   ```
   ~/s390-tools $ checkpatch.pl --no-tree --git master..HEAD
   ```

   Interpret the checkpatch messages wisely - e.g. the 80 character rule can be
   ignored for printf format strings.

   [checkpatch]: https://github.com/torvalds/linux/blob/master/scripts/checkpatch.pl

6. Push the changes to your fork of the repository
   ```
   ~/s390-tools $ git push origin contrib-doc-pr
   ```

7. Go to the GitHub website of your s390-tools fork and create a pull request
   for your branch "contrib-doc-pr"

### Update a pull request during review

If there are changes requested during the review process, you have to update
your code in the pull request.

To retain the existing review comments, add commits on top of your pull request
branch. Depending on the size and number of changes, a rebase of the pull
request might be required. This will be communicated during the review.

1. Update your code with new commits
   ```
   ~/s390-tools $ vi CONTRIBUTING.md
   ~/s390-tools $ git add CONTRIBUTING.md
   ~/s390-tools $ git commit -s -m "CONTRIBUTING: Add update PR info"
   ```

2. Update your pull request by pushing changes
   ```
   ~/s390-tools $ git push origin contrib-doc-pr
   ```

### Finalize a pull request

After the review process is finished or if you are explicitly asked for it,
you have to create a clean commit series.

1. Save branch to "contrib-doc-pr.v1"
   ```
   $ cd s390-tools
   ~/s390-tools $ git branch contrib-doc-pr.v1
   ```

2. Use interactive git rebase to merge commits, adjust commit messages,
   and rebase onto your local master branch
   ```
   ~/s390-tools $ git rebase -i master
   ```

   An editor is started and shows the following:
   ```
   pick 2c73b9fc CONTRIBUTING: Outline steps to submit code
   pick fcfb0412 CONTRIBUTING: Add update PR info
   ```

   To merge the update into the original commit, replace "pick fcfb0412"
   with "squash fcfb0412".

   ```
   pick 2c73b9fc CONTRIBUTING: Outline steps to submit code
   squash fcfb0412 CONTRIBUTING: Add update PR info
   ```

   Save the document and exit the editor to finish the merge. Another editor
   window is presented to modify the commit message.

   You now could change the commit message as follows:

   ```
   CONTRIBUTING: Outline steps to submit code

   Explain in more detail how to submit s390-tools contributions as GitHub
   pull requests and how to update already submitted pull requests.

   Signed-off-by: Random Developer <random@developer.example.com>
   ```

   With interactive rebasing you can also change the order of commits and
   modify commit messages with "reword".

3. Use `git push` with the force option to replace the existing pull request
   with your locally modified commits
   ```
   ~/s390-tools $ git push --force origin contrib-doc-pr
   ```

### Rebase a pull request

If changes are made to the master branch in the official s390-tools
repository you may be asked to rebase your branch with your contribution
onto it. This can be required to prevent any merge conflicts that might
arise when integrating your contribution.

1. Fetch all upstream changes from the official s390-tools repository,
   rebase your local master branch and update the master branch
   on your fork
   ```
   ~/s390-tools $ git fetch upstream
   ~/s390-tools $ git checkout master
   ~/s390-tools $ git rebase upstream/master
   ~/s390-tools $ git push origin master
   ```

2. Rebase your branch with your contribution onto the master branch of
   the official s390-tools repository
   ```
   ~/s390-tools $ git checkout contrib-doc-pr
   ~/s390-tools $ git rebase master
   ```

3. Use `git push` with the force option to replace the existing pull
   request with your locally modified commits
   ```
   ~/s390-tools $ git push --force origin contrib-doc-pr
   ```