blob: 187cd0fe1dcac3e7a693bd864909332846f2044b [file] [log] [blame]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001= Gerrit Code Review - Project Configuration File Format
Fredrik Luthandera3cf3542012-07-04 16:55:35 -07002
3This page explains the storage format of Gerrit's project configuration
4and access control models.
5
6The web UI access control panel is a front end for human-readable
7configuration files under the +refs/meta/config+ namespace in the
8affected project. Direct manipulation of these files is mainly
9relevant in an automation scenario of the access controls.
10
11
Edwin Kempin329416c2022-07-25 15:52:35 +020012[[refs-meta-config]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080013== The +refs/meta/config+ namespace
Fredrik Luthandera3cf3542012-07-04 16:55:35 -070014
15The namespace contains three different files that play different
16roles in the permission model. With read permission to that reference,
17it is possible to fetch the +refs/meta/config+ reference to a local
18repository. A nice side effect is that you can also upload changes
19to project permissions and review them just like with regular code
20changes. The preview changes option is also provided on the UI. Please note
21that you will have to configure push rights for the +refs/meta/config+ name
22space if you'd like to use the possibility to automate permission updates.
23
Björn Pedersend169b6d2016-08-31 17:56:45 +020024== Property inheritance
25
26If a property is set to INHERIT, then the value from the parent project is
27used. If the property is not set in any parent project, the default value is
28FALSE.
Fredrik Luthandera3cf3542012-07-04 16:55:35 -070029
30[[file-project_config]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080031== The file +project.config+
Fredrik Luthandera3cf3542012-07-04 16:55:35 -070032
33The +project.config+ file contains the link between groups and their
34permitted actions on reference patterns in this project and any projects
35that inherit its permissions.
36
37The format in this file corresponds to the Git config file format, so
38if you want to automate your permissions it is a good idea to use the
39+git config+ command when writing to the file. This way you know you
40don't accidentally break the format of the file.
41
42Here follows a +git config+ command example:
43
44----
45$ git config -f project.config project.description "Rights inherited by all other projects"
46----
47
48Below you will find an example of the +project.config+ file format:
49
50----
51[project]
52 description = Rights inherited by all other projects
53[access "refs/*"]
54 read = group Administrators
David Myllykangasb3ccec62015-01-21 15:41:13 +010055[access "refs/heads/*"]
56 label-Your-Label-Here = -1..+1 group Administrators
Fredrik Luthandera3cf3542012-07-04 16:55:35 -070057[capability]
58 administrateServer = group Administrators
59[receive]
60 requireContributorAgreement = false
David Myllykangasb3ccec62015-01-21 15:41:13 +010061[label "Your-Label-Here"]
62 function = MaxWithBlock
63 value = -1 Your -1 Description
64 value = 0 Your No score Description
65 value = +1 Your +1 Description
Fredrik Luthandera3cf3542012-07-04 16:55:35 -070066----
67
68As you can see, there are several sections.
69
70The link:#project-section[+project+ section] appears once per project.
71
Edwin Kempin8313eb42023-07-26 09:55:38 +000072The link:#access-subsection[+access+ section] appears once per reference pattern,
73such as `+refs/*+` or `+refs/heads/*+`. Only one access section per pattern is
David Pursehouseacb5c1d2016-08-29 10:29:57 +090074allowed.
Fredrik Luthandera3cf3542012-07-04 16:55:35 -070075
76The link:#receive-section[+receive+ section] appears once per project.
77
78The link:#submit-section[+submit+ section] appears once per project.
79
80The link:#capability-section[+capability+] section only appears once, and only
81in the +All-Projects+ repository. It controls core features that are configured
David Pursehouseacb5c1d2016-08-29 10:29:57 +090082on a global level.
Fredrik Luthandera3cf3542012-07-04 16:55:35 -070083
David Myllykangasb3ccec62015-01-21 15:41:13 +010084The link:#label-section[+label+] section can appear multiple times. You can
85also redefine the text and behavior of the built in label types `Code-Review`
86and `Verified`.
Fredrik Luthandera3cf3542012-07-04 16:55:35 -070087
Edwin Kempin424f96c62016-10-13 09:00:55 +020088Optionally a +commentlink+ section can be added to define project-specific
89comment links. The +commentlink+ section has the same format as the
90link:config-gerrit.html#commentlink[+commentlink+ section in gerrit.config]
91which is used to define global comment links.
92
Fredrik Luthandera3cf3542012-07-04 16:55:35 -070093[[project-section]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080094=== Project section
Fredrik Luthandera3cf3542012-07-04 16:55:35 -070095
96The project section includes configuration of project settings.
97
98These are the keys:
99
Changcheng Xiao5ecb6422019-01-15 17:17:04 +0100100[[description]]description::
101+
102A description for the project.
103
Edwin Kempin1fd08542019-06-26 10:20:29 +0200104[[state]]state::
Changcheng Xiao5ecb6422019-01-15 17:17:04 +0100105+
106This setting defines the state of the project. A project can have the
107following states:
108
109- `Active`:
110+
111The project is active and users can see and modify the project according
112to their access rights on the project.
113
114- `Read Only`:
115+
116The project is read only and all modifying operations on it are
117disabled. E.g. this means that pushing to this project fails for all
118users even if they have push permissions assigned on it.
119+
120Setting a project to this state is an easy way to temporary close a
121project, as you can keep all write access rights in place and they will
122become active again as soon as the project state is set back to
123`Active`.
124+
125This state also makes sense if a project was moved to another location.
126In this case all new development should happen in the new project and
127you want to prevent that somebody accidentally works on the old
128project, while keeping the old project around for old references.
129
130- `Hidden`:
131+
Rikard Almgrencffafe42023-08-15 16:16:37 +0200132The project is hidden; It will not appear in any searches and is only visible
133to project owners by going directly to the repository admin page. Other users
134are not able to see the project even if they have read permissions granted on
135the project.
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700136
137
138[[receive-section]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800139=== Receive section
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700140
141The receive section includes configuration of project-specific
142receive settings:
143
144[[receive.requireContributorAgreement]]receive.requireContributorAgreement::
145+
146Controls whether or not a user must complete a contributor agreement before
Edwin Kempin51e78512022-04-06 12:49:04 +0200147they can upload changes. Default is `INHERIT`. If `All-Projects` enables this
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700148option then the dependent project must set it to false if users are not
149required to sign a contributor agreement prior to submitting changes for that
150specific project. To use that feature the global option in `gerrit.config`
151must be enabled:
152link:config-gerrit.html#auth.contributorAgreements[auth.contributorAgreements].
153
154[[receive.requireSignedOffBy]]receive.requireSignedOffBy::
155+
156Sign-off can be a requirement for some projects (for example Linux kernel uses
157it). Sign-off is a line at the end of the commit message which certifies who
158is the author of the commit. Its main purpose is to improve tracking of who
159did what, especially with patches. Default is `INHERIT`, which means that this
160property is inherited from the parent project.
161
Han-Wen Nienhuyscdde7a302019-07-24 12:19:16 +0200162[[receive.requireChangeId]]receive.requireChangeId::
163+
164The `Require Change-Id in commit message` option defines whether a
165link:user-changeid.html[Change-Id] in the commit message is required
166for pushing a commit for review. If this option is set, trying to push
167a commit for review that doesn't contain a Change-Id in the commit
168message fails with link:error-missing-changeid.html[missing Change-Id
169in commit message footer].
Edwin Kempin677e7e62021-06-15 09:28:48 +0200170+
Han-Wen Nienhuyscdde7a302019-07-24 12:19:16 +0200171It is recommended to set this option and use a
172link:user-changeid.html#create[commit-msg hook] (or other client side
173tooling like EGit) to automatically generate Change-Id's for new
174commits. This way the Change-Id is automatically in place when changes
175are reworked or rebased and uploading new patch sets gets easy.
Edwin Kempin677e7e62021-06-15 09:28:48 +0200176+
Han-Wen Nienhuyscdde7a302019-07-24 12:19:16 +0200177If this option is not set, commits can be uploaded without a Change-Id,
178but then users have to remember to copy the assigned Change-Id from the
179change screen and insert it manually into the commit message when they
180want to upload a second patch set.
Edwin Kempin677e7e62021-06-15 09:28:48 +0200181+
Han-Wen Nienhuyscdde7a302019-07-24 12:19:16 +0200182Default is `INHERIT`, which means that this property is inherited from
183the parent project. The global default for new hosts is `true`
Edwin Kempin677e7e62021-06-15 09:28:48 +0200184+
Han-Wen Nienhuyscdde7a302019-07-24 12:19:16 +0200185This option is deprecated and future releases will behave as if this
186is always `true`.
187
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700188[[receive.maxObjectSizeLimit]]receive.maxObjectSizeLimit::
189+
190Maximum allowed Git object size that receive-pack will accept. If an object
191is larger than the given size the pack-parsing will abort and the push
192operation will fail. If set to zero then there is no limit.
193+
194Project owners can use this setting to prevent developers from pushing
David Pursehouse2e548682018-08-01 15:12:47 +0200195objects which are too large to Gerrit. This setting can also be set in
196`gerrit.config` globally (link:config-gerrit.html#receive.maxObjectSizeLimit[
197receive.maxObjectSizeLimit]).
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700198+
David Pursehoused508ef02018-08-03 15:09:56 +0100199The project specific setting in `project.config` may not set a value higher
200than the global limit (if configured). In other words, it is only honored when
201it further reduces the global limit.
202+
David Pursehouse3f9c7402018-09-05 18:43:03 +0900203When link:config-gerrit.html#receive.inheritProjectMaxObjectSizeLimit[
204`receive.inheritProjectmaxObjectSizeLimit`] is enabled in the global config,
205the value is inherited from the parent project. Otherwise, it is not inherited
206and must be explicitly set per project.
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700207+
208Default is zero.
209+
210Common unit suffixes of k, m, or g are supported.
211
Rob Ward2cf12952014-01-26 20:38:12 +0000212[[receive.checkReceivedObjects]]receive.checkReceivedObjects::
213+
214Controls whether or not the JGit functionality for checking received objects
215is enabled.
216+
217By default Gerrit checks the validity of git objects. Setting this variable to
218false should not be used unless a project with history containing invalid
219objects needs to be pushed into a Gerrit repository.
220+
221This functionality is provided as some other git implementations have allowed
222bad history to be written into git repositories. If these repositories need pushing
223up to Gerrit then the JGit checks need to be disabled.
224+
225The default value for this is true, false disables the checks.
226
Dave Borowitz5170e0f2015-06-18 21:05:29 -0400227[[receive.enableSignedPush]]receive.enableSignedPush::
228+
229Controls whether server-side signed push validation is enabled on the
230project. Only has an effect if signed push validation is enabled on the
231server; see the link:config-gerrit.html#receive.enableSignedPush[global
232configuration] for details.
233+
234Default is `INHERIT`, which means that this property is inherited from
235the parent project.
236
Dave Borowitz0543c732015-10-20 10:35:26 -0400237[[receive.requireSignedPush]]receive.requireSignedPush::
238+
239Controls whether server-side signed push validation is required on the
240project. Only has an effect if signed push validation is enabled on the
David Pursehouseab5383f2018-09-14 08:23:10 +0900241server, and link:#receive.enableSignedPush[`receive.enableSignedPush`] is
242set on the project. See the
243link:config-gerrit.html#receive.enableSignedPush[global configuration]
244for details.
Dave Borowitz0543c732015-10-20 10:35:26 -0400245+
246Default is `INHERIT`, which means that this property is inherited from
247the parent project.
248
Saša Živkov225b7a72015-11-17 17:37:43 +0100249[[receive.rejectImplicitMerges]]receive.rejectImplicitMerges::
250+
251Controls whether a check for implicit merges will be performed when changes are
252pushed for review. An implicit merge is a case where merging an open change
253would implicitly merge another branch into the target branch. Typically, this
254happens when a change is done on master and, by mistake, pushed to a stable branch
255for review. When submitting such change, master would be implicitly merged into
256stable without anyone noticing that. When this option is set to 'true' Gerrit
257will reject the push if an implicit merge is detected.
258+
259This check is only done for non-merge commits, merge commits are not subject of
260the implicit merge check.
261+
262Default is `INHERIT`, which means that this property is inherited from
263the parent project.
264
Changcheng Xiao81a0df92019-01-15 18:27:58 +0100265[[receive.createNewChangeForAllNotInTarget]]receive.createNewChangeForAllNotInTarget::
266+
Edwin Kempin3a5f8742021-06-15 09:18:34 +0200267This option provides a convenience for selecting
268link:user-upload.html#base[the merge base] by setting it automatically
269to the target branch's tip so you can create new changes for all
270commits not in the target branch.
Edwin Kempin677e7e62021-06-15 09:28:48 +0200271+
Changcheng Xiao81a0df92019-01-15 18:27:58 +0100272This option is disabled if the tip of the push is a merge commit.
Edwin Kempin677e7e62021-06-15 09:28:48 +0200273+
Changcheng Xiao81a0df92019-01-15 18:27:58 +0100274This option also only works if there are no merge commits in the
275commit chain, in such cases it fails warning the user that such
276pushes can only be performed by manually specifying
277link:user-upload.html#base[bases]
Edwin Kempin677e7e62021-06-15 09:28:48 +0200278+
Changcheng Xiao81a0df92019-01-15 18:27:58 +0100279This option is useful if you want to push a change to your personal
280branch first and for review to another branch for example. Or in cases
281where a commit is already merged into a branch and you want to create
282a new open change for that commit on another branch.
283
Changcheng Xiaod089b4a2017-08-10 14:05:22 +0200284[[change-section]]
285=== Change section
286
287The change section includes configuration for project-specific change settings:
288
289[[change.privateByDefault]]change.privateByDefault::
290+
291Controls whether all new changes in the project are set as private by default.
292+
293Note that a new change will be public if the `is_private` field in
294link:rest-api-changes.html#change-input[ChangeInput] is set to `false` explicitly
295when calling the link:rest-api-changes.html#create-change[CreateChange] REST API
296or the `remove-private` link:user-upload.html#private[PushOption] is used during
297the Git push.
298+
299Default is `INHERIT`, which means that this property is inherited from
300the parent project.
301
David Ostrovsky96909942018-06-10 08:30:33 +0200302[[change.workInProgressByDefault]]change.workInProgressByDefault::
303+
304Controls whether all new changes in the project are set as WIP by default.
305+
306Note that a new change will be ready if the `workInProgress` field in
307link:rest-api-changes.html#change-input[ChangeInput] is set to `false` explicitly
308when calling the link:rest-api-changes.html#create-change[CreateChange] REST API
309or the `ready` link:user-upload.html#wip[PushOption] is used during
310the Git push.
311+
312Default is `INHERIT`, which means that this property is inherited from
313the parent project.
314
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700315[[submit-section]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800316=== Submit section
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700317
318The submit section includes configuration of project-specific
319submit settings:
320
Edwin Kempinf6da0ef2023-08-09 06:42:48 +0000321[[content_merge]]
322
323[[submit.mergeContent]]submit.mergeContent::
Sven Selberg03946a62020-06-18 08:26:48 +0200324+
Edwin Kempin87f22e12022-08-02 14:48:52 +0200325Defines whether Gerrit will try to do a content merge when a path conflict
326occurs while submitting a change.
327+
328A path conflict occurs when the same file has been changed on both sides of a
329merge, e.g. when the same file has been touched in a change and concurrently in
330the target branch.
331+
332Doing a content merge means that Gerrit attempts to merge the conflicting file
333contents from both sides of the merge. This is successful if the touched lines
334(plus some surrounding context lines) do not overlap (i.e. both sides touch
335distinct lines).
336+
337NOTE: The content merge setting is not relevant when
Edwin Kempin8be14b02022-08-02 16:55:29 +0200338link:#fast_forward_only[fast forward only] is configured as the
Edwin Kempin87f22e12022-08-02 14:48:52 +0200339link:#submit.action[submit action] because in this case Gerrit will never
340perform a merge, rebase or cherry-pick on submit.
341+
342If content merges are disabled, the submit button in the Gerrit web UI is
343disabled, if any path conflict would occur on submitting the change. Users then
344need to rebase the change manually to resolve the path conflict and then get
345the change re-approved so that they can submit it.
346+
347NOTE: If only distinct lines have been touched on both sides, rebasing the
348change from the Gerrit UI is sufficient to resolve the path conflict, since the
349rebase action always does the rebase with content merge enabled.
350+
351The advantage of enabling content merges on submit is that it makes it less
352likely that change submissions are rejected due to conflicts. Each change
353submission that goes through with content merge, but would be rejected
354otherwise, saves the user from needing to do extra work to get the change
355submitted (rebase the change, get it re-approved and then submit it again).
356+
357On the other hand, disabling content merges decreases the chance of breaking
358branches by submitting content merges of incompatible modifications in the same
359file, e.g. a function is removed on one side and a new usage of that function
360is added on the other side. Note, that the chance of breaking a branch by
361incompatible modifications is only reduced, but not eliminated, e.g. even with
362content merges disabled it's possible that a function is removed in one file
363and a new usage of that function is added in another file.
364+
365The huge drawback of disabling content merge is that users need to do extra
366work when a change isn't submittable due to a path conflict which could be
367avoided if content merge was enabled (see above). In addition to this, it also
368confuses and frustrates users if a change submission is rejected by Gerrit due
369to a path conflict, but then when they rebase the change manually they do not
370see any conflict (because manual rebases are always done with content merge
371enabled).
372+
373In general, the stability gain of disabling content merges is not worth the
374overhead and confusion that this adds for users, which is why disabling content
375merges is highly discouraged.
376+
377Valid values are `true`, `false`, or `INHERIT`.
378+
379The default is `INHERIT`.
380+
381NOTE: Project owners can also set this option in the Gerrit UI:
382`Browse` > `Repositories` > my/repository > `Allow content merges`.
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700383
Sven Selberg03946a62020-06-18 08:26:48 +0200384[[submit.action]]submit.action::
385+
Edwin Kempind736da32022-07-27 12:41:05 +0200386Defines the submit action aka submit type aka submit strategy that Gerrit
387should use to integrate changes into the target branch when they are submitted.
388+
389In general, submitting a change only merges the change if all its dependencies
390are also submitted. The only exception is the `cherry pick` submit action which
Edwin Kempind2278ae2022-07-27 17:27:44 +0200391ignores dependencies and hence is not recommended to be used (see
392link:#cherry_pick[below]).
Edwin Kempind736da32022-07-27 12:41:05 +0200393+
394[[submit-type]]
395--
396The following submit actions are supported:
397
398[[merge_if_necessary]]
399* 'merge if necessary':
400+
Edwin Kempin8be14b02022-08-02 16:55:29 +0200401With this action, when a change is being submitted, Gerrit fast-forwards the
402target branch if possible, and otherwise creates a merge commit automatically.
403+
404A fast-forward is possible if the commit that represents the current patch set
405of the change has the current head of the target branch in its parent lineage.
406+
407If a fast-forward is not possible, Gerrit automatically creates a merge commit
408that merges the current patch set of the change into the target branch and then
409the target branch is fast-forwarded to the merge commit.
410+
411The behavior of this submit action is identical with the classical `git merge`
412behavior, or
413link:https://git-scm.com/docs/git-merge#Documentation/git-merge.txt---ff[git
414merge --ff].
415+
416With this submit action the commits that have been reviewed and approved are
417retained in the git history of the target branch. This means, by looking at the
418history of the target branch, you can see for all commits when they were
419originally committed and on which parent commit they were originally based.
Edwin Kempind736da32022-07-27 12:41:05 +0200420
421[[always_merge]]
422[[merge_always]]
423* 'merge always':
424+
Edwin Kempin31db5732022-08-03 15:21:08 +0200425With this action, when a change is being submitted, Gerrit always creates a
426merge commit, even if a fast-forward is possible.
427+
428This is identical to the behavior of
429link:https://git-scm.com/docs/git-merge#Documentation/git-merge.txt---no-ff[git merge --no-ff].
430+
431With this submit action the commits that have been reviewed and approved are
432retained in the git history of the target branch. This means, by looking at the
433history of the target branch, you can see for all commits when they were
434originally committed and on which parent commit they were originally based. In
435addition, from the merge commits you can see when the changes were submitted
436and it's possible to follow submissions with `git log --first-parent`.
Edwin Kempind736da32022-07-27 12:41:05 +0200437
438[[rebase_if_necessary]]
439* 'rebase if necessary':
440+
Edwin Kempin8be14b02022-08-02 16:55:29 +0200441With this action, when a change is being submitted, Gerrit fast-forwards the
442target branch if possible, and otherwise does a rebase automatically.
443+
444A fast-forward is possible if the commit that represents the current patch set
445of the change has the current head of the target branch in its parent lineage.
446+
447If a fast-forward is not possible, Gerrit automatically rebases the current
448patch set of the change on top of the current head of the target branch and
449then the target branch is fast-forwarded to the rebased commit.
450+
451With this submit action, when a rebase is performed, the original commits that
452have been reviewed and approved do not become part of the target branch's
453history. This means the information on when the original commits were committed
454and on which parent they were based is not retained in the branch history.
455+
456Using this submit action results in a linear history of the target branch,
457unless merge commits are being submitted. For some people this is an advantage
458since they find the linear history easier to read.
459+
460NOTE: Rebasing merge commits is not supported. If a change with a merge commit
461is submitted the link:#merge_if_necessary[merge if necessary] submit action is
462applied.
Edwin Kempind736da32022-07-27 12:41:05 +0200463
464[[rebase_always]]
465* 'rebase always':
466+
Edwin Kempin31db5732022-08-03 15:21:08 +0200467With this action, when a change is being submitted, Gerrit always does a
468rebase, even if a fast-forward is possible.
469+
470With this submit action, the original commits that have been reviewed and
471approved do not become part of the target branch's history. This means the
472information on when the original commits were committed and on which parent
473they were based is not retained in the branch history.
474+
475Using this submit action results in a linear history of the target branch,
476unless merge commits are being submitted. For some people this is an advantage
477since they find the linear history easier to read.
478+
479NOTE: Rebasing merge commits is not supported. If a change with a merge commit
480is submitted the link:#merge_if_necessary[merge if necessary] submit action is
481applied.
Edwin Kempind736da32022-07-27 12:41:05 +0200482+
Edwin Kempinc5721b42022-08-03 15:03:01 +0200483When rebasing the patchset, Gerrit automatically appends onto the end of the
484commit message a short summary of the change's approvals, and a URL link back
485to the change in the web UI (see link:#submit-footers[below]).
486+
487The footers that are added are exactly the same footers that are also added by
Yifan Yang35753932023-05-17 14:53:47 -0700488the link:#cherry_pick[cherry pick] action. Thus, the `rebase always` action can
Edwin Kempinc5721b42022-08-03 15:03:01 +0200489be considered similar to the `cherry pick` action, but with the important
490distinction that `rebase always` does not ignore dependencies, which is why
491using the `rebase always` action should be preferred over the `cherry pick`
492submit action.
Edwin Kempind736da32022-07-27 12:41:05 +0200493
494[[fast_forward_only]]
Edwin Kempin966626a2022-08-02 12:49:06 +0200495* 'fast forward only' (usage generally not recommended):
Edwin Kempind736da32022-07-27 12:41:05 +0200496+
Edwin Kempin966626a2022-08-02 12:49:06 +0200497With this action a change can only be submitted if at submit time the target
498branch can be fast-forwarded to the commit that represents the current patch
499set of the change. This means in order for a change to be submittable its
500current patch set must have the current head of the target branch in its parent
501lineage.
Edwin Kempind736da32022-07-27 12:41:05 +0200502+
Edwin Kempin966626a2022-08-02 12:49:06 +0200503The advantage of using this action is that the target branch is always updated
504to the exact commit that has been reviewed and approved. In particular, if CI
505verification is configured, this means that the CI verified the exact commit to
506which the target branch is being fast-forwarded on submit (assuming no approval
507copying is configured for CI votes).
508+
509The huge drawback of using this action is that whenever one change is submitted
510all other open changes for the same branch, that are not successors of the
511submitted change, become non-submittable, since the target branch can no longer
512be fast-forwarded to their current patch sets. Making these changes submittable
513again requires rebasing and re-approving/re-verifying them. For most projects
514this causes an unreasonable amount of overhead that doesn't justify the
515stability gain by verifying exact commits so that using this submit action is
516generally discouraged. Using this action should only be considered for projects
517that have a low frequency of changes and that have special requirements to
518never break any target branch.
519+
520NOTE: With this submit action Gerrit does not create merge commits on
521submitting a change, but merge commits that are created on the client, prior to
522uploading to Gerrit for review, may still be submitted.
Edwin Kempind736da32022-07-27 12:41:05 +0200523
524[[cherry_pick]]
Edwin Kempind7eda152022-08-02 12:48:33 +0200525* 'cherry pick' (usage not recommended, use link:#rebase_always[rebase always]
Edwin Kempind2278ae2022-07-27 17:27:44 +0200526instead):
Edwin Kempind736da32022-07-27 12:41:05 +0200527+
Edwin Kempind2278ae2022-07-27 17:27:44 +0200528With this submit action Gerrit always performs a cherry pick of the current
529patch set when a change is submitted. This ignores the parent lineage and
530instead creates a brand new commit on top of the current head of the target
531branch. The submitter becomes the committer of the new commit and the original
532commit author is retained.
Edwin Kempind736da32022-07-27 12:41:05 +0200533+
Edwin Kempind2278ae2022-07-27 17:27:44 +0200534Ignoring change dependencies on submit is often confusing for users. For users
535that stack changes on top of each other, it's unexpected that these
536dependencies are ignored on submit. Ignoring dependencies also means that
537submitters need to submit the changes individually in the correct order.
538Otherwise it's likely that submissions fail due to conflicts or that the
539target branch gets broken (because it contains the submitted change, but not
540its predecessors which may be required for the submitted change to work
541correctly).
Edwin Kempind736da32022-07-27 12:41:05 +0200542+
Edwin Kempind2278ae2022-07-27 17:27:44 +0200543If link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`]
544is enabled changes that have the same topic are submitted together, the same as
545with all other submit actions. This means by setting the same topic on all
546dependent changes it's possible to submit a stack of changes together and
547overcome the limitation that change dependencies are ignored.
548+
549When cherry picking the patchset, Gerrit automatically appends onto the end of
550the commit message a short summary of the change's approvals, and a URL link
Edwin Kempinc5721b42022-08-03 15:03:01 +0200551back to the change in the web UI (see link:#submit-footers[below]).
Edwin Kempind2278ae2022-07-27 17:27:44 +0200552+
553Using this submit action is not recommended because it ignores change
554dependencies, instead link:#rebase_always[rebase always] should be used which
555behaves the same way except that it respects change dependencies (in particular
556`rebase always` adds the same kind of footers to the merged commit as
557`cherry pick`).
Edwin Kempind736da32022-07-27 12:41:05 +0200558
559--
560+
561[[submit_type_inherit]]
562In addition the submit action can be set to `Inherit`, which means that the
563value that is configured in the parent project applies. For new projects
564`Inherit` is the default, unless the default is overridden by the global
565link:config-gerrit.html#repository.name.defaultSubmitType[defaultSubmitType]
566configuration. Configuring `Inherit` for the `All-Projects` root project is
567equivalent to configuring link:#merge_if_necessary[merge if necessary].
568+
569If `submit.action` is not set, the default is 'merge if necessary'.
570+
Edwin Kempin95aff9e2022-08-03 15:41:42 +0200571NOTE: The different submit actions are also described in the
572link:https://docs.google.com/presentation/d/1C73UgQdzZDw0gzpaEqIC6SPujZJhqamyqO1XOHjH-uk/edit#slide=id.g4d6c16487b_1_800[Gerrit - Concepts and Workflows]
573presentation, where their behavior is visualized by git commit graphs.
574+
Edwin Kempin202fd4a2022-08-02 15:17:25 +0200575NOTE: If Gerrit performs a merge, rebase or cherry-pick as part of the
576change submission (true for all submit actions, except for
577link:#fast_forward_only[fast forward only]), it is controlled by the
578link:#submit.mergeContent[mergeContent] setting whether a content merge is
579performed when there is a path conflict.
580+
Edwin Kempind229dc32022-08-04 12:45:15 +0200581NOTE: If Gerrit performs a merge, rebase or cherry-pick as part of the
582change submission (true for all submit actions, except for
583link:#fast_forward_only[fast forward only]), it can be that trying to submit
584a change would fail due to Git conflicts (if the same lines were modified
585concurrently, or if link:#submit.mergeContent[mergeContent] is disabled also if
586the same files were modified concurrently). In this case the submit button in
587the Gerrit web UI is disabled and a tooltip on the disabled submit button
588informs about the change being non-mergeable.
589+
Edwin Kempinc5721b42022-08-03 15:03:01 +0200590[[submit-footers]]
591--
592NOTE: If Gerrit performs a rebase or cherry-pick as part of the change
593submission (true for link:#rebase_if_necessary[rebase if necessary],
594link:#rebase_always[rebase always] and link:#cherry_pick[cherry pick]) Gerrit
595inserts additional footers into the commit message of the newly created
596commit: +
597 +
598* `Change-Id: <change-id>` (only if this footer is not already present, see
599 link:user-changeid.html[Change-Id]) +
600* `Reviewed-on: <change-url>` (links to the change in Gerrit where this commit
601 was reviewed) +
602* `Reviewed-by: <reviewer>` (once for every reviewer with a positive
603 `Code-Review` vote) +
604* `Tested-by: <reviewer>` (once for every reviewer with a positive `Verified`
605 vote) +
606* `<label-name>: <reviewer>` (once for every reviewer with a positive vote on
607 any other label) +
Edwin Kempin318c3222022-08-03 15:32:38 +0200608 +
609In addition, plugins that implement a
610link:dev-plugins.html#change-message-modifier[Change Message Modifier] may add
611additional custom footers.
Edwin Kempinc5721b42022-08-03 15:03:01 +0200612--
613+
Edwin Kempind736da32022-07-27 12:41:05 +0200614NOTE: For the value of `submit.action` in `project.config` use the exact
615spelling as given above, e.g. 'merge if necessary' (without the single quotes,
616but with the spaces).
617+
618NOTE: Project owners can also set the submit action in the Gerrit UI:
619`Browse` > `Repositories` > my/repository > `Submit type`
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700620
Sven Selberg03946a62020-06-18 08:26:48 +0200621[[submit.matchAuthorToCommitterDate]]submit.matchAuthorToCommitterDate::
622+
623Defines whether the author date will be changed to match the submitter date upon submit, so that
624git log shows when the change was submitted instead of when the author last committed. Valid
625values are 'true', 'false', or 'INHERIT'. The default is 'INHERIT'. This option only takes effect
626in submit strategies which already modify the commit, i.e. Cherry Pick, Rebase Always, and
627(when rebase is necessary) Rebase If Necessary.
Patrick Hiesel5a316352017-06-22 15:38:06 +0200628
Sven Selberg03946a62020-06-18 08:26:48 +0200629[[submit.rejectEmptyCommit]]submit.rejectEmptyCommit::
630+
631Defines whether empty commits should be rejected when a change is merged. When using
632link:#submit.action[submit action] Cherry Pick, Rebase If Necessary or Rebase Always changes may
633become empty upon submit, since the rebase|cherry-pick can lead to an empty commit. If this option
634is set to 'true' the merge would fail in such a case. An empty commit is still allowed as the
635initial commit on a branch.
Patrick Hieseldc285c72018-01-08 17:20:15 +0100636
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700637
638[[access-section]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800639=== Access section
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700640
Edwin Kempin8313eb42023-07-26 09:55:38 +0000641[[access.inheritFrom]]access.inheritFrom::
642+
643Name of the parent project from which access rights are inherited.
644+
645If not set, access rights are inherited from the `All-Projects` root project.
646
647[[access-subsection]]
648==== Access subsection
649
650+access+ subsections for references connect access rights to groups. Each group
651listed must exist in the link:#file-groups[+groups+ file].
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700652
653Please refer to the
654link:access-control.html#access_categories[Access Categories]
655documentation for a full list of available access rights.
656
657
Shawn Pearce9cfcebd2014-04-25 16:41:12 -0700658[[mimetype-section]]
659=== MIME Types section
660
661The +mimetype+ section may be configured to force the web code
662reviewer to return certain MIME types by file path. MIME types
663may be used to activate syntax highlighting.
664
665----
666[mimetype "text/x-c"]
667 path = *.pkt
668[mimetype "text/x-java"]
669 path = api/current.txt
670----
671
672
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700673[[capability-section]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800674=== Capability section
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700675
676The +capability+ section only appears once, and only in the +All-Projects+
677repository. It controls Gerrit administration capabilities that are configured
678on a global level.
679
680Please refer to the
681link:access-control.html#global_capabilities[Global Capabilities]
682documentation for a full list of available capabilities.
683
David Myllykangasb3ccec62015-01-21 15:41:13 +0100684[[label-section]]
685=== Label section
686
687Please refer to link:config-labels.html#label_custom[Custom Labels] documentation.
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700688
Youssef Elghareeb78287a42021-12-06 17:04:23 +0100689[[submit-requirement-section]]
690=== Submit Requirement section
691
692Please refer to link:config-submit-requirements.html[Configuring Submit
693Requirements] documentation.
694
Saša Živkov944b8382014-05-08 14:02:15 +0200695[[branchOrder-section]]
696=== branchOrder section
697
698Defines a branch ordering which is used for backporting of changes.
699Backporting will be offered for a change (in the Gerrit UI) for all
700more stable branches where the change can merge cleanly.
701
702[[branchOrder.branch]]branchOrder.branch::
703+
704A branch name, typically multiple values will be defined. The order of branch
705names in this section defines the branch order. The topmost is considered to be
706the least stable branch (typically the master branch) and the last one the
707most stable (typically the last maintained release branch).
Edwin Kempin677e7e62021-06-15 09:28:48 +0200708+
Saša Živkov944b8382014-05-08 14:02:15 +0200709Example:
Edwin Kempin677e7e62021-06-15 09:28:48 +0200710+
Saša Živkov944b8382014-05-08 14:02:15 +0200711----
712[branchOrder]
713 branch = master
714 branch = stable-2.9
715 branch = stable-2.8
716 branch = stable-2.7
717----
Edwin Kempin677e7e62021-06-15 09:28:48 +0200718+
Saša Živkov944b8382014-05-08 14:02:15 +0200719The `branchOrder` section is inheritable. This is useful when multiple or all
720projects follow the same branch rules. A `branchOrder` section in a child
721project completely overrides any `branchOrder` section from a parent i.e. there
722is no merging of `branchOrder` sections. A present but empty `branchOrder`
723section removes all inherited branch order.
Edwin Kempin677e7e62021-06-15 09:28:48 +0200724+
Saša Živkov944b8382014-05-08 14:02:15 +0200725Branches not listed in this section will not be included in the mergeability
726check. If the `branchOrder` section is not defined then the mergeability of a
727change into other branches will not be done.
728
Patrick Hiesel6db5afd2017-03-21 09:40:03 +0100729[[reviewer-section]]
730=== reviewer section
731
732Defines config options to adjust a project's reviewer workflow such as enabling
733reviewers and CCs by email.
734
735[[reviewer.enableByEmail]]reviewer.enableByEmail::
736+
737A boolean indicating if reviewers and CCs that do not currently have a Gerrit
738account can be added to a change by providing their email address.
Edwin Kempin677e7e62021-06-15 09:28:48 +0200739+
Edwin Kempine441f972022-02-08 15:22:08 +0100740This setting only takes effect for changes that are readable by anonymous users.
Edwin Kempin677e7e62021-06-15 09:28:48 +0200741+
Patrick Hiesel502b26c2017-03-29 14:19:23 +0200742Default is `INHERIT`, which means that this property is inherited from
743the parent project. If the property is not set in any parent project, the
744default value is `FALSE`.
Saša Živkov944b8382014-05-08 14:02:15 +0200745
Nitzan Gur-Furmanaab10692022-11-08 11:40:10 +0100746[[reviewer.skipAddingAuthorAndCommitterAsReviewers]]reviewer.skipAddingAuthorAndCommitterAsReviewers::
747+
748Whether to skip adding the Git commit author and committer as reviewers for
749a new change.
750+
751Default is `INHERIT`, which means that this property is inherited from
752the parent project. If the property is not set in any parent project, the
753default value is `FALSE`.
754
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700755[[file-groups]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800756== The file +groups+
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700757
758Each group in this list is linked with its UUID so that renaming of
759groups is possible without having to rewrite every +groups+ file
760in every repository where it's used.
761
762This is what the default groups file for +All-Projects.git+ looks like:
763
764----
765# UUID Group Name
766#
7673d6da7dc4e99e6f6e5b5196e21b6f504fc530bba Administrators
768global:Anonymous-Users Anonymous Users
Khai Do5aaeee32014-09-05 10:14:32 -0700769global:Change-Owner Change Owner
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700770global:Project-Owners Project Owners
771global:Registered-Users Registered Users
772----
773
774This file can't be written to by the +git config+ command.
775
776In order to reference a group in +project.config+, it must be listed in
777the +groups+ file. When editing permissions through the web UI this
778file is maintained automatically, but when pushing updates to
779+refs/meta/config+ this must be dealt with by hand. Gerrit will refuse
780+project.config+ files that refer to groups not listed in +groups+.
781
782The UUID of a group can be found on the General tab of the group's page
783in the web UI or via the +-v+ option to
784link:cmd-ls-groups.html[the +ls-groups+ SSH command].
785
786
787[[file-rules_pl]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800788== The file +rules.pl+
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700789
790The +rules.pl+ files allows you to replace or amend the default Prolog
791rules that control e.g. what conditions need to be fulfilled for a
792change to be submittable. This file content should be
793interpretable by the 'Prolog Cafe' interpreter.
794
795You can read more about the +rules.pl+ file and the prolog rules on
796link:prolog-cookbook.html[the Prolog cookbook page].
797
David Pursehousee200d0d2019-06-05 12:08:19 +0900798GERRIT
799------
800Part of link:index.html[Gerrit Code Review]
801
802SEARCHBOX
803---------