You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Development/Policies-and-Procedures/Code-Contribution.md
+51-36Lines changed: 51 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,10 +33,9 @@ Contributors must fork the [asterisk/asterisk](https://github.com/asterisk/aster
33
33
1. Run `gh repo fork asterisk/asterisk` and `gh repo fork asterisk/testsuite`
34
34
2. Run `gh repo clone <user>/asterisk` and `gh repo clone <user>/testsuite`
35
35
36
-
!!! warning
37
-
The `gh repo fork` command has a `--clone` option that's supposed to do both of the above steps at the same time however it rarely works and usually creates a mess. The reason is that after a fork operation *appears* to complete, it can take a few seconds before GitHub finishes background work during which time attempts to clone will fail. The `gh` tool doesn't account for this and tries to clone immediately which fails with a "repository not found" message.
38
-
39
-
[//]: #(end-warning)
36
+
/// warning
37
+
The `gh repo fork` command has a `--clone` option that's supposed to do both of the above steps at the same time however it rarely works and usually creates a mess. The reason is that after a fork operation *appears* to complete, it can take a few seconds before GitHub finishes background work during which time attempts to clone will fail. The `gh` tool doesn't account for this and tries to clone immediately which fails with a "repository not found" message.
38
+
///
40
39
41
40
Git Remotes will automatically be created for both your fork and the upstream repo.
42
41
@@ -58,25 +57,21 @@ The name of the new branch can be anything but it does show up in the GitHub UI
58
57
59
58
If your work fixes a bug in a non-master branch that doesn't exist in the higher branches, start with the highest version branch that the fix does apply to. For instance, if the fix applies to 20 and 18 but not master, base your new branch on 20.
60
59
61
-
!!! warning
62
-
You should never do work in the upstream branches like '18', '20', or 'master'. Doing so will pollute those branches in your fork and will make updating them difficult.
63
-
64
-
[//]: #(end-warning)
60
+
/// warning
61
+
You should never do work in the upstream branches like '18', '20', or 'master'. Doing so will pollute those branches in your fork and will make updating them difficult.
62
+
///
65
63
66
64
Now make your change and test locally.
67
65
68
-
!!! note
69
-
You no longer have to create entries in the doc/CHANGES-staging or doc/UPGRADE-staging directories. The change logs are generated from the commit messages. See below.
70
-
71
-
[//]: #(end-note)
66
+
/// note
67
+
You MUST not create entries in the doc/CHANGES-staging or doc/UPGRADE-staging directories as was done in the past. The change logs are now generated from the commit messages. See below.
68
+
///
72
69
73
70
### Commit
74
71
75
72
Commit messages should follow the guidelines established in [Commit Messages](/Development/Policies-and-Procedures/Commit-Messages).
76
73
77
-
---
78
-
79
-
Sample Commit Message
74
+
Sample Commit Message
80
75
81
76
```
82
77
app_foo.c: Add new 'x' argument to the Foo application
@@ -99,7 +94,6 @@ UserNote: The Foo dialplan application now takes an additional argument
99
94
100
95
UpgradeNote: The X argument to the OldFoo application has been removed
101
96
and will cause an error if supplied.
102
-
103
97
```
104
98
105
99
### Test and check for Cherry-pick-ability
@@ -115,11 +109,33 @@ You should always use option 1 when possible. Unlike Gerrit, GitHub was never d
115
109
116
110
When you've finished your work and committed, you can create a new pull request by running `gh pr create --fill --base 18`. The `--fill` option sets the pull request description to the same as the commit message and the `--base` option indicates which asterisk branch the pull request is targeted for. This is similar to running `git review 18` to create a new Gerrit review. When prompted where the new branch should be pushed, choose your fork, NOT the upstream repo.
117
111
118
-
You _may_ create a pull request that has more than 1 commit if the commits represent a progression of changes that can stand on their own. For instance, a commit to add a feature to a core source file, then a commit against an application to use that new feature. You must be prepared to do some juggling however should changes be requested to an earlier commit in the series. For instance, if changes were requested to commit 1, you'd have to reset your working branch back to that commit, make your fixes, do a `git commit -a --amend`, reapply commit 2 on top of that ammended commit, then do a `git push --force` to update the PR.
112
+
#### Multiple Commits
113
+
There are only two situations where you may have multiple commits in a single pull request:
114
+
115
+
##### Multiple commits that stand on their own
116
+
You may have multiple commits in a single PR if the the commits represent a progression of changes that can stand on their own. For instance, a commit to add a feature to a core source file, then a commit against an application to use that new feature. In this case, each commit will be merged as is, without squashing. You must be prepared to do some juggling however should changes be requested to an earlier commit in the series. For instance, if changes were requested to commit 1, you'd have to reset your working branch back to that commit, make your fixes, do a `git commit -a --amend`, reapply commit 2 on top of that amended commit, then do a `git push --force` to update the PR.
117
+
118
+
/// warning
119
+
You MUST add a comment with the exact content below to your PR otherwise the automation will flag your PR with a reminder that multiple commits are not normally allowed and will prevent it from being merged.
120
+
```
121
+
multiple-commits: standalone
122
+
```
123
+
///
119
124
120
-
!!! warning
121
-
You must **never** add commits to a pull request that fix issues in earlier commits in that PR.
125
+
##### Interim commits to facilitate code review
126
+
You may also have multiple commits in your PR if your PR is complex and you've been asked to make changes that might be hard for a reviewer to re-review. For instance, if your initial commit contained multiple changes to multiple files and you've been requested to make a change like correcting indentation, it might be hard for a reviewer to figure out what changed if you made your changes and just did an amend and force push on your original commit because the changes might be buried in what was a large diff originally.
122
127
128
+
In this case, the multiple commits will NOT be allowed into the codebase as is. You MUST ultimately squash your interim commits down to one commit before it will be approved for merging.
129
+
130
+
/// warning
131
+
You MUST add a comment with the exact content below to your PR otherwise the automation will flag your PR with a reminder that multiple commits are not normally allowed.
132
+
133
+
```
134
+
multiple-commits: interim
135
+
```
136
+
///
137
+
138
+
#### Cherry picking
123
139
If you want your change to be automatically cherry-picked to other branches, you'll need to add a comment to your pull request. Head over to <https://github.com/asterisk/asterisk/pulls> and open your PR. Add a comment with a `cherry-pick-to: <branch>"` header line for each branch. For example, if the PR is against the master branch and you want it cherry-picked down to 20 and 18, add a comment with the following:
124
140
125
141
```text
@@ -131,18 +147,18 @@ Each branch must be on a separate line and don't put anything else in the commen
131
147
132
148
If you don't need your PR automatically cherry-picked, please add a comment stating `cherry-pick-to: none`. This saves us not having to ask if you want it cherry-picked.
133
149
134
-
!!! note
135
-
You can also add comments to a PR from the command line with `gh pr comment`. See the man page for more info.
136
-
137
-
[//]: #(end-note)
150
+
/// note
151
+
You can also add comments to a PR from the command line with `gh pr comment`. See the man page for more info.
152
+
///
138
153
139
-
!!! warning
140
-
Don't add the cherry-pick-to lines to the commit message or the PR description. They're only searched for in PR comments.
141
154
142
-
!!! warning
143
-
**If you change your mind and don't want your PR automatically cherry-picked, edit the comment and replace the "cherry-pick-to" lines with a single `cherry-pick-to: none` line** Don't use formatting or other means to say "nevermind". The automation might not understand.
155
+
/// warning
156
+
Don't add the cherry-pick-to lines to the commit message or the PR description. They're only searched for in PR comments.
157
+
///
144
158
145
-
[//]: #(end-warning)
159
+
/// warning
160
+
**If you change your mind and don't want your PR automatically cherry-picked, edit the comment and replace the "cherry-pick-to" lines with a single `cherry-pick-to: none` line** Don't use formatting or other means to say "nevermind". The automation might not understand.
161
+
///
146
162
147
163
## Pull Request Review Process
148
164
@@ -152,7 +168,7 @@ As with Gerrit reviews, a new PR triggers a set of tests and checks. If you bro
152
168
153
169
Every contributor will be required to sign a new Contributor License Agreement before their first PR can be merged. One of the PR checks will be "license/cla" which looks like this...
154
170
155
-

171
+

156
172
157
173
which indicates that you haven't signed it yet. Click the "Details" link to be taken to the page that allows you to fill out the form and sign. Acceptance is automatic so there should be no delay and you only have to do this once. YOUR PR CANNOT BE MERGED UNTIL THIS CHECK IS COMPLETED.
158
174
@@ -176,11 +192,11 @@ These are comments you have about the code itself. These are left by clicking o
176
192
* Clicking on a specific line in a file to leave a single comment without a vote. This is similar to clicking on a file in a Gerrit review, entering a comment on a specific line, but leaving your vote at "0" when clicking the "REPLY" button. Unlike a general comment however, this type of comment creates a "conversation" which must be "resolved" before a PR can be merged.
177
193
* Clicking on a specific line in a file to leave a comment and starting a review where you will leave a vote. This is similar to clicking on a file in a Gerrit review, entering a comment on a specific line, then setting your vote to +1 or -1 when clicking the "REPLY" button.
178
194
179
-
!!! note
180
-
If you're not the submitter but you want to test a PR locally, you can do so easily with the gh tool:
195
+
/// note
196
+
If you're not the submitter but you want to test a PR locally, you can do so easily with the gh tool:
181
197
`gh pr checkout <pr_number>`
198
+
///
182
199
183
-
[//]: #(end-note)
184
200
185
201
### Address Review Comments and Test Failures
186
202
@@ -192,10 +208,9 @@ If you need to make code changes to address comments or failures, the process is
192
208
193
209
This will force push the commit to your fork first, then update the PR with the new commit and restart the testing process.
194
210
195
-
!!! warning
196
-
Unlike Gerrit, GitHub allows you to have multiple commits for a pull request but it was intended to allow a PR to be broken up into multiple logical chunks, not to address review comments. Using multiple commits to address review comments will make the commit history messy and confusing. Please amend and force push otherwise the PR will be rejected.
197
-
198
-
[//]: #(end-warning)
211
+
/// note
212
+
If you feel that amending and force pushing changes might make it har for a reviewer to detect what was changed/fixed, you can push interim commits. See [Interim commits to facilitate code review](#interim-commits-to-facilitate-code-review) above.
Copy file name to clipboardExpand all lines: docs/Development/Policies-and-Procedures/Commit-Messages.md
+6-8Lines changed: 6 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,12 +2,9 @@
2
2
3
3
A commit message serves to notify others of the changes made to the Asterisk source code, both in a historical sense and in the present. Commit messages are **incredibly** important to the continued success of the Asterisk project. Developers maintaining the Asterisk project in the future will often only have your commit message to guide them in why a particular change was made. For non-developers, archives containing commit messages may be used when searching for fixes to a particular bug. Be sure that the information contained in your message will help them out.
4
4
5
-
!!! warning Follow These Guidelines
6
-
Commit messages are part of your code change. Committing code with a poorly written commit message creates a maintenance problem for everyone in the Asterisk project.
7
-
8
-
9
-
[//]: #(end-warning)
10
-
5
+
/// warning | Follow These Guidelines
6
+
Commit messages are part of your code change. Committing code with a poorly written commit message creates a maintenance problem for everyone in the Asterisk project.
7
+
///
11
8
12
9
This page describes the expected format for commit messages used when submitting code to the Asterisk project. See [Code Contribution](/Development/Policies-and-Procedures/Code-Contribution) for more information about pushing your commit for review.
13
10
@@ -47,8 +44,9 @@ Since we've moved to a complete GitHub SCM solution, commit messages will automa
47
44
48
45
GitHub and our release process support several commit message trailers that are used by the change log generation process. The trailer name MUST start on a new line, be followed by a colin (`:`) and each should be separated by a blank line. If specified at all, the trailers listed below MUST be the last items in the commit message.
49
46
50
-
!!! warning
51
-
If you specify any other trailers, including ones that were formerly acceptable, they will become part of the official trailer they follow. So, if you insist on adding trailers like `ASTERISK-nnnnn`, `Signed-Off-By` or `Reported-By` they MUST come BEFORE the first of the official trailers.
47
+
/// warning | Unofficial Trailers
48
+
If you specify any other trailers, including ones that were formerly acceptable, they will become part of the official trailer they follow. So, if you insist on adding trailers like `ASTERISK-nnnnn`, `Signed-Off-By` or `Reported-By` they MUST come BEFORE the first of the official trailers.
0 commit comments