Skip to content

Commit 342c691

Browse files
authored
Add a few more comments to the CONTRIBUTING.md document (#18469)
* Explain how to title your Backport PR * Advise that the first comment in a PR should explain the PR * Include information about BREAKING changes * Include information about backports/frontports * Add reference command for creating backports * Add reference commandline for creating large characters * Add information about updating docs/config.yaml * Update year in the copyright Signed-off-by: Andrew Thornton <[email protected]>
1 parent f9b27d2 commit 342c691

File tree

1 file changed

+74
-4
lines changed

1 file changed

+74
-4
lines changed

CONTRIBUTING.md

Lines changed: 74 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,15 @@ Some of the key points:
134134
if that is not related to your PR, please make *another* PR for that.
135135
* Split big pull requests into multiple small ones. An incremental change
136136
will be faster to review than a huge PR.
137+
* Use the first comment as a summary explainer of your PR and you should keep this up-to-date as the PR evolves.
138+
139+
If your PR could cause a breaking change you must add a BREAKING section to this comment e.g.:
140+
141+
```
142+
## :warning: BREAKING :warning:
143+
```
144+
145+
To explain how this could affect users and how to mitigate these changes.
137146

138147
## Styleguide
139148

@@ -203,13 +212,74 @@ In general, HTTP methods are chosen as follows:
203212
* **PUT** endpoints return status **No Content (204)**, used to **add/assign** existing Objects (e.g. User) to something (e.g. Org-Team)
204213
* **PATCH** endpoints return changed object and status **OK (200)**, used to **edit/change** an existing object
205214

206-
207215
An endpoint which changes/edits an object expects all fields to be optional (except ones to identify the object, which are required).
208-
209216
### Endpoints returning lists should
210217
* support pagination (`page` & `limit` options in query)
211218
* set `X-Total-Count` header via **SetTotalCountHeader** ([example](https://github.com/go-gitea/gitea/blob/7aae98cc5d4113f1e9918b7ee7dd09f67c189e3e/routers/api/v1/repo/issue.go#L444))
212219

220+
## Large Character Comments
221+
222+
Throughout the codebase there are large-text comments for sections of code, e.g.:
223+
224+
```go
225+
// __________ .__
226+
// \______ \ _______ _|__| ______ _ __
227+
// | _// __ \ \/ / |/ __ \ \/ \/ /
228+
// | | \ ___/\ /| \ ___/\ /
229+
// |____|_ /\___ >\_/ |__|\___ >\/\_/
230+
// \/ \/ \/
231+
```
232+
233+
These were created using the `figlet` tool with the `graffiti` font.
234+
235+
A simple way of creating these is to use the following:
236+
237+
```bash
238+
figlet -f graffiti Review | sed -e's+^+// +' - | xclip -sel clip -in
239+
```
240+
241+
## Backports and Frontports
242+
243+
Occasionally backports of PRs are required.
244+
245+
The backported PR title should be:
246+
247+
```
248+
Title of backported PR (#ORIGINAL_PR_NUMBER)
249+
```
250+
251+
The first two lines of the summary of the backporting PR should be:
252+
253+
```
254+
Backport #ORIGINAL_PR_NUMBER
255+
256+
```
257+
258+
with the rest of the summary matching the original PR. Similarly for frontports
259+
260+
---
261+
262+
The below is a script that may be helpful in creating backports. YMMV.
263+
264+
```bash
265+
#!/bin/sh
266+
PR="$1"
267+
SHA="$2"
268+
VERSION="$3"
269+
270+
if [ -z "$SHA" ]; then
271+
SHA=$(gh api /repos/go-gitea/gitea/pulls/$PR -q '.merge_commit_sha')
272+
fi
273+
274+
if [ -z "$VERSION" ]; then
275+
VERSION="v1.16"
276+
fi
277+
278+
echo git checkout origin/release/"$VERSION" -b backport-$PR-$VERSION
279+
git checkout origin/release/"$VERSION" -b backport-$PR-$VERSION
280+
git cherry-pick $SHA && git commit --amend && git push zeripath backport-$PR-$VERSION && xdg-open https://github.com/go-gitea/gitea/compare/release/"$VERSION"...zeripath:backport-$PR-$VERSION
281+
282+
```
213283

214284
## Developer Certificate of Origin (DCO)
215285

@@ -351,15 +421,15 @@ be reviewed by two maintainers and must pass the automatic tests.
351421
* If it is bugfix version create PR for changelog on branch `release/v$vmaj.$vmin` and wait till it is reviewed and merged.
352422
* Add a tag as `git tag -s -F release.notes v$vmaj.$vmin.$`, release.notes file could be a temporary file to only include the changelog this version which you added to `CHANGELOG.md`.
353423
* And then push the tag as `git push origin v$vmaj.$vmin.$`. Drone CI will automatically create a release and upload all the compiled binary. (But currently it doesn't add the release notes automatically. Maybe we should fix that.)
354-
* If needed send PR for changelog on branch `main`.
424+
* If needed send a frontport PR for the changelog to branch `main` and update the version in `docs/config.yaml` to refer to the new version.
355425
* Send PR to [blog repository](https://gitea.com/gitea/blog) announcing the release.
356426

357427
## Copyright
358428

359429
Code that you contribute should use the standard copyright header:
360430

361431
```
362-
// Copyright 2020 The Gitea Authors. All rights reserved.
432+
// Copyright 2022 The Gitea Authors. All rights reserved.
363433
// Use of this source code is governed by a MIT-style
364434
// license that can be found in the LICENSE file.
365435
```

0 commit comments

Comments
 (0)