blob: 7a0e3057a77dd92550c09311942929b91ecc397d [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
72The link:#access-section[+access+ section] appears once per reference pattern,
Jonathan Nieder5758f182015-03-30 11:28:55 -070073such 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+
132The project is hidden and only visible to project owners. Other users
133are not able to see the project even if they have read permissions
134granted on the project.
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700135
136
137[[receive-section]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800138=== Receive section
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700139
140The receive section includes configuration of project-specific
141receive settings:
142
143[[receive.requireContributorAgreement]]receive.requireContributorAgreement::
144+
145Controls whether or not a user must complete a contributor agreement before
Edwin Kempin51e78512022-04-06 12:49:04 +0200146they can upload changes. Default is `INHERIT`. If `All-Projects` enables this
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700147option then the dependent project must set it to false if users are not
148required to sign a contributor agreement prior to submitting changes for that
149specific project. To use that feature the global option in `gerrit.config`
150must be enabled:
151link:config-gerrit.html#auth.contributorAgreements[auth.contributorAgreements].
152
153[[receive.requireSignedOffBy]]receive.requireSignedOffBy::
154+
155Sign-off can be a requirement for some projects (for example Linux kernel uses
156it). Sign-off is a line at the end of the commit message which certifies who
157is the author of the commit. Its main purpose is to improve tracking of who
158did what, especially with patches. Default is `INHERIT`, which means that this
159property is inherited from the parent project.
160
Han-Wen Nienhuyscdde7a302019-07-24 12:19:16 +0200161[[receive.requireChangeId]]receive.requireChangeId::
162+
163The `Require Change-Id in commit message` option defines whether a
164link:user-changeid.html[Change-Id] in the commit message is required
165for pushing a commit for review. If this option is set, trying to push
166a commit for review that doesn't contain a Change-Id in the commit
167message fails with link:error-missing-changeid.html[missing Change-Id
168in commit message footer].
Edwin Kempin677e7e62021-06-15 09:28:48 +0200169+
Han-Wen Nienhuyscdde7a302019-07-24 12:19:16 +0200170It is recommended to set this option and use a
171link:user-changeid.html#create[commit-msg hook] (or other client side
172tooling like EGit) to automatically generate Change-Id's for new
173commits. This way the Change-Id is automatically in place when changes
174are reworked or rebased and uploading new patch sets gets easy.
Edwin Kempin677e7e62021-06-15 09:28:48 +0200175+
Han-Wen Nienhuyscdde7a302019-07-24 12:19:16 +0200176If this option is not set, commits can be uploaded without a Change-Id,
177but then users have to remember to copy the assigned Change-Id from the
178change screen and insert it manually into the commit message when they
179want to upload a second patch set.
Edwin Kempin677e7e62021-06-15 09:28:48 +0200180+
Han-Wen Nienhuyscdde7a302019-07-24 12:19:16 +0200181Default is `INHERIT`, which means that this property is inherited from
182the parent project. The global default for new hosts is `true`
Edwin Kempin677e7e62021-06-15 09:28:48 +0200183+
Han-Wen Nienhuyscdde7a302019-07-24 12:19:16 +0200184This option is deprecated and future releases will behave as if this
185is always `true`.
186
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700187[[receive.maxObjectSizeLimit]]receive.maxObjectSizeLimit::
188+
189Maximum allowed Git object size that receive-pack will accept. If an object
190is larger than the given size the pack-parsing will abort and the push
191operation will fail. If set to zero then there is no limit.
192+
193Project owners can use this setting to prevent developers from pushing
David Pursehouse2e548682018-08-01 15:12:47 +0200194objects which are too large to Gerrit. This setting can also be set in
195`gerrit.config` globally (link:config-gerrit.html#receive.maxObjectSizeLimit[
196receive.maxObjectSizeLimit]).
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700197+
David Pursehoused508ef02018-08-03 15:09:56 +0100198The project specific setting in `project.config` may not set a value higher
199than the global limit (if configured). In other words, it is only honored when
200it further reduces the global limit.
201+
David Pursehouse3f9c7402018-09-05 18:43:03 +0900202When link:config-gerrit.html#receive.inheritProjectMaxObjectSizeLimit[
203`receive.inheritProjectmaxObjectSizeLimit`] is enabled in the global config,
204the value is inherited from the parent project. Otherwise, it is not inherited
205and must be explicitly set per project.
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700206+
207Default is zero.
208+
209Common unit suffixes of k, m, or g are supported.
210
Rob Ward2cf12952014-01-26 20:38:12 +0000211[[receive.checkReceivedObjects]]receive.checkReceivedObjects::
212+
213Controls whether or not the JGit functionality for checking received objects
214is enabled.
215+
216By default Gerrit checks the validity of git objects. Setting this variable to
217false should not be used unless a project with history containing invalid
218objects needs to be pushed into a Gerrit repository.
219+
220This functionality is provided as some other git implementations have allowed
221bad history to be written into git repositories. If these repositories need pushing
222up to Gerrit then the JGit checks need to be disabled.
223+
224The default value for this is true, false disables the checks.
225
Dave Borowitz5170e0f2015-06-18 21:05:29 -0400226[[receive.enableSignedPush]]receive.enableSignedPush::
227+
228Controls whether server-side signed push validation is enabled on the
229project. Only has an effect if signed push validation is enabled on the
230server; see the link:config-gerrit.html#receive.enableSignedPush[global
231configuration] for details.
232+
233Default is `INHERIT`, which means that this property is inherited from
234the parent project.
235
Dave Borowitz0543c732015-10-20 10:35:26 -0400236[[receive.requireSignedPush]]receive.requireSignedPush::
237+
238Controls whether server-side signed push validation is required on the
239project. Only has an effect if signed push validation is enabled on the
David Pursehouseab5383f2018-09-14 08:23:10 +0900240server, and link:#receive.enableSignedPush[`receive.enableSignedPush`] is
241set on the project. See the
242link:config-gerrit.html#receive.enableSignedPush[global configuration]
243for details.
Dave Borowitz0543c732015-10-20 10:35:26 -0400244+
245Default is `INHERIT`, which means that this property is inherited from
246the parent project.
247
Saša Živkov225b7a72015-11-17 17:37:43 +0100248[[receive.rejectImplicitMerges]]receive.rejectImplicitMerges::
249+
250Controls whether a check for implicit merges will be performed when changes are
251pushed for review. An implicit merge is a case where merging an open change
252would implicitly merge another branch into the target branch. Typically, this
253happens when a change is done on master and, by mistake, pushed to a stable branch
254for review. When submitting such change, master would be implicitly merged into
255stable without anyone noticing that. When this option is set to 'true' Gerrit
256will reject the push if an implicit merge is detected.
257+
258This check is only done for non-merge commits, merge commits are not subject of
259the implicit merge check.
260+
261Default is `INHERIT`, which means that this property is inherited from
262the parent project.
263
Changcheng Xiao81a0df92019-01-15 18:27:58 +0100264[[receive.createNewChangeForAllNotInTarget]]receive.createNewChangeForAllNotInTarget::
265+
Edwin Kempin3a5f8742021-06-15 09:18:34 +0200266This option provides a convenience for selecting
267link:user-upload.html#base[the merge base] by setting it automatically
268to the target branch's tip so you can create new changes for all
269commits not in the target branch.
Edwin Kempin677e7e62021-06-15 09:28:48 +0200270+
Changcheng Xiao81a0df92019-01-15 18:27:58 +0100271This option is disabled if the tip of the push is a merge commit.
Edwin Kempin677e7e62021-06-15 09:28:48 +0200272+
Changcheng Xiao81a0df92019-01-15 18:27:58 +0100273This option also only works if there are no merge commits in the
274commit chain, in such cases it fails warning the user that such
275pushes can only be performed by manually specifying
276link:user-upload.html#base[bases]
Edwin Kempin677e7e62021-06-15 09:28:48 +0200277+
Changcheng Xiao81a0df92019-01-15 18:27:58 +0100278This option is useful if you want to push a change to your personal
279branch first and for review to another branch for example. Or in cases
280where a commit is already merged into a branch and you want to create
281a new open change for that commit on another branch.
282
Changcheng Xiaod089b4a2017-08-10 14:05:22 +0200283[[change-section]]
284=== Change section
285
286The change section includes configuration for project-specific change settings:
287
288[[change.privateByDefault]]change.privateByDefault::
289+
290Controls whether all new changes in the project are set as private by default.
291+
292Note that a new change will be public if the `is_private` field in
293link:rest-api-changes.html#change-input[ChangeInput] is set to `false` explicitly
294when calling the link:rest-api-changes.html#create-change[CreateChange] REST API
295or the `remove-private` link:user-upload.html#private[PushOption] is used during
296the Git push.
297+
298Default is `INHERIT`, which means that this property is inherited from
299the parent project.
300
David Ostrovsky96909942018-06-10 08:30:33 +0200301[[change.workInProgressByDefault]]change.workInProgressByDefault::
302+
303Controls whether all new changes in the project are set as WIP by default.
304+
305Note that a new change will be ready if the `workInProgress` field in
306link:rest-api-changes.html#change-input[ChangeInput] is set to `false` explicitly
307when calling the link:rest-api-changes.html#create-change[CreateChange] REST API
308or the `ready` link:user-upload.html#wip[PushOption] is used during
309the Git push.
310+
311Default is `INHERIT`, which means that this property is inherited from
312the parent project.
313
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700314[[submit-section]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800315=== Submit section
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700316
317The submit section includes configuration of project-specific
318submit settings:
319
David Pursehousec0c92892020-06-18 21:11:30 +0900320[[content_merge]]submit.mergeContent::
Sven Selberg03946a62020-06-18 08:26:48 +0200321+
Edwin Kempin87f22e12022-08-02 14:48:52 +0200322Defines whether Gerrit will try to do a content merge when a path conflict
323occurs while submitting a change.
324+
325A path conflict occurs when the same file has been changed on both sides of a
326merge, e.g. when the same file has been touched in a change and concurrently in
327the target branch.
328+
329Doing a content merge means that Gerrit attempts to merge the conflicting file
330contents from both sides of the merge. This is successful if the touched lines
331(plus some surrounding context lines) do not overlap (i.e. both sides touch
332distinct lines).
333+
334NOTE: The content merge setting is not relevant when
Edwin Kempin8be14b02022-08-02 16:55:29 +0200335link:#fast_forward_only[fast forward only] is configured as the
Edwin Kempin87f22e12022-08-02 14:48:52 +0200336link:#submit.action[submit action] because in this case Gerrit will never
337perform a merge, rebase or cherry-pick on submit.
338+
339If content merges are disabled, the submit button in the Gerrit web UI is
340disabled, if any path conflict would occur on submitting the change. Users then
341need to rebase the change manually to resolve the path conflict and then get
342the change re-approved so that they can submit it.
343+
344NOTE: If only distinct lines have been touched on both sides, rebasing the
345change from the Gerrit UI is sufficient to resolve the path conflict, since the
346rebase action always does the rebase with content merge enabled.
347+
348The advantage of enabling content merges on submit is that it makes it less
349likely that change submissions are rejected due to conflicts. Each change
350submission that goes through with content merge, but would be rejected
351otherwise, saves the user from needing to do extra work to get the change
352submitted (rebase the change, get it re-approved and then submit it again).
353+
354On the other hand, disabling content merges decreases the chance of breaking
355branches by submitting content merges of incompatible modifications in the same
356file, e.g. a function is removed on one side and a new usage of that function
357is added on the other side. Note, that the chance of breaking a branch by
358incompatible modifications is only reduced, but not eliminated, e.g. even with
359content merges disabled it's possible that a function is removed in one file
360and a new usage of that function is added in another file.
361+
362The huge drawback of disabling content merge is that users need to do extra
363work when a change isn't submittable due to a path conflict which could be
364avoided if content merge was enabled (see above). In addition to this, it also
365confuses and frustrates users if a change submission is rejected by Gerrit due
366to a path conflict, but then when they rebase the change manually they do not
367see any conflict (because manual rebases are always done with content merge
368enabled).
369+
370In general, the stability gain of disabling content merges is not worth the
371overhead and confusion that this adds for users, which is why disabling content
372merges is highly discouraged.
373+
374Valid values are `true`, `false`, or `INHERIT`.
375+
376The default is `INHERIT`.
377+
378NOTE: Project owners can also set this option in the Gerrit UI:
379`Browse` > `Repositories` > my/repository > `Allow content merges`.
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700380
Sven Selberg03946a62020-06-18 08:26:48 +0200381[[submit.action]]submit.action::
382+
Edwin Kempind736da32022-07-27 12:41:05 +0200383Defines the submit action aka submit type aka submit strategy that Gerrit
384should use to integrate changes into the target branch when they are submitted.
385+
386In general, submitting a change only merges the change if all its dependencies
387are also submitted. The only exception is the `cherry pick` submit action which
Edwin Kempind2278ae2022-07-27 17:27:44 +0200388ignores dependencies and hence is not recommended to be used (see
389link:#cherry_pick[below]).
Edwin Kempind736da32022-07-27 12:41:05 +0200390+
391[[submit-type]]
392--
393The following submit actions are supported:
394
395[[merge_if_necessary]]
396* 'merge if necessary':
397+
Edwin Kempin8be14b02022-08-02 16:55:29 +0200398With this action, when a change is being submitted, Gerrit fast-forwards the
399target branch if possible, and otherwise creates a merge commit automatically.
400+
401A fast-forward is possible if the commit that represents the current patch set
402of the change has the current head of the target branch in its parent lineage.
403+
404If a fast-forward is not possible, Gerrit automatically creates a merge commit
405that merges the current patch set of the change into the target branch and then
406the target branch is fast-forwarded to the merge commit.
407+
408The behavior of this submit action is identical with the classical `git merge`
409behavior, or
410link:https://git-scm.com/docs/git-merge#Documentation/git-merge.txt---ff[git
411merge --ff].
412+
413With this submit action the commits that have been reviewed and approved are
414retained in the git history of the target branch. This means, by looking at the
415history of the target branch, you can see for all commits when they were
416originally committed and on which parent commit they were originally based.
Edwin Kempind736da32022-07-27 12:41:05 +0200417
418[[always_merge]]
419[[merge_always]]
420* 'merge always':
421+
Edwin Kempin31db5732022-08-03 15:21:08 +0200422With this action, when a change is being submitted, Gerrit always creates a
423merge commit, even if a fast-forward is possible.
424+
425This is identical to the behavior of
426link:https://git-scm.com/docs/git-merge#Documentation/git-merge.txt---no-ff[git merge --no-ff].
427+
428With this submit action the commits that have been reviewed and approved are
429retained in the git history of the target branch. This means, by looking at the
430history of the target branch, you can see for all commits when they were
431originally committed and on which parent commit they were originally based. In
432addition, from the merge commits you can see when the changes were submitted
433and it's possible to follow submissions with `git log --first-parent`.
Edwin Kempind736da32022-07-27 12:41:05 +0200434
435[[rebase_if_necessary]]
436* 'rebase if necessary':
437+
Edwin Kempin8be14b02022-08-02 16:55:29 +0200438With this action, when a change is being submitted, Gerrit fast-forwards the
439target branch if possible, and otherwise does a rebase automatically.
440+
441A fast-forward is possible if the commit that represents the current patch set
442of the change has the current head of the target branch in its parent lineage.
443+
444If a fast-forward is not possible, Gerrit automatically rebases the current
445patch set of the change on top of the current head of the target branch and
446then the target branch is fast-forwarded to the rebased commit.
447+
448With this submit action, when a rebase is performed, the original commits that
449have been reviewed and approved do not become part of the target branch's
450history. This means the information on when the original commits were committed
451and on which parent they were based is not retained in the branch history.
452+
453Using this submit action results in a linear history of the target branch,
454unless merge commits are being submitted. For some people this is an advantage
455since they find the linear history easier to read.
456+
457NOTE: Rebasing merge commits is not supported. If a change with a merge commit
458is submitted the link:#merge_if_necessary[merge if necessary] submit action is
459applied.
Edwin Kempinc5721b42022-08-03 15:03:01 +0200460+
461When rebasing the patchset, Gerrit automatically appends onto the end of the
462commit message a short summary of the change's approvals, and a URL link back
463to the change in the web UI (see link:#submit-footers[below]). If a fast-forward
464is done no footers are added.
Edwin Kempind736da32022-07-27 12:41:05 +0200465
466[[rebase_always]]
467* 'rebase always':
468+
Edwin Kempin31db5732022-08-03 15:21:08 +0200469With this action, when a change is being submitted, Gerrit always does a
470rebase, even if a fast-forward is possible.
471+
472With this submit action, the original commits that have been reviewed and
473approved do not become part of the target branch's history. This means the
474information on when the original commits were committed and on which parent
475they were based is not retained in the branch history.
476+
477Using this submit action results in a linear history of the target branch,
478unless merge commits are being submitted. For some people this is an advantage
479since they find the linear history easier to read.
480+
481NOTE: Rebasing merge commits is not supported. If a change with a merge commit
482is submitted the link:#merge_if_necessary[merge if necessary] submit action is
483applied.
Edwin Kempind736da32022-07-27 12:41:05 +0200484+
Edwin Kempinc5721b42022-08-03 15:03:01 +0200485When rebasing the patchset, Gerrit automatically appends onto the end of the
486commit message a short summary of the change's approvals, and a URL link back
487to the change in the web UI (see link:#submit-footers[below]).
488+
489The footers that are added are exactly the same footers that are also added by
490the link:cherry_pick[cherry pick] action. Thus, the `rebase always` action can
491be considered similar to the `cherry pick` action, but with the important
492distinction that `rebase always` does not ignore dependencies, which is why
493using the `rebase always` action should be preferred over the `cherry pick`
494submit action.
Edwin Kempind736da32022-07-27 12:41:05 +0200495
496[[fast_forward_only]]
Edwin Kempin966626a2022-08-02 12:49:06 +0200497* 'fast forward only' (usage generally not recommended):
Edwin Kempind736da32022-07-27 12:41:05 +0200498+
Edwin Kempin966626a2022-08-02 12:49:06 +0200499With this action a change can only be submitted if at submit time the target
500branch can be fast-forwarded to the commit that represents the current patch
501set of the change. This means in order for a change to be submittable its
502current patch set must have the current head of the target branch in its parent
503lineage.
Edwin Kempind736da32022-07-27 12:41:05 +0200504+
Edwin Kempin966626a2022-08-02 12:49:06 +0200505The advantage of using this action is that the target branch is always updated
506to the exact commit that has been reviewed and approved. In particular, if CI
507verification is configured, this means that the CI verified the exact commit to
508which the target branch is being fast-forwarded on submit (assuming no approval
509copying is configured for CI votes).
510+
511The huge drawback of using this action is that whenever one change is submitted
512all other open changes for the same branch, that are not successors of the
513submitted change, become non-submittable, since the target branch can no longer
514be fast-forwarded to their current patch sets. Making these changes submittable
515again requires rebasing and re-approving/re-verifying them. For most projects
516this causes an unreasonable amount of overhead that doesn't justify the
517stability gain by verifying exact commits so that using this submit action is
518generally discouraged. Using this action should only be considered for projects
519that have a low frequency of changes and that have special requirements to
520never break any target branch.
521+
522NOTE: With this submit action Gerrit does not create merge commits on
523submitting a change, but merge commits that are created on the client, prior to
524uploading to Gerrit for review, may still be submitted.
Edwin Kempind736da32022-07-27 12:41:05 +0200525
526[[cherry_pick]]
Edwin Kempind7eda152022-08-02 12:48:33 +0200527* 'cherry pick' (usage not recommended, use link:#rebase_always[rebase always]
Edwin Kempind2278ae2022-07-27 17:27:44 +0200528instead):
Edwin Kempind736da32022-07-27 12:41:05 +0200529+
Edwin Kempind2278ae2022-07-27 17:27:44 +0200530With this submit action Gerrit always performs a cherry pick of the current
531patch set when a change is submitted. This ignores the parent lineage and
532instead creates a brand new commit on top of the current head of the target
533branch. The submitter becomes the committer of the new commit and the original
534commit author is retained.
Edwin Kempind736da32022-07-27 12:41:05 +0200535+
Edwin Kempind2278ae2022-07-27 17:27:44 +0200536Ignoring change dependencies on submit is often confusing for users. For users
537that stack changes on top of each other, it's unexpected that these
538dependencies are ignored on submit. Ignoring dependencies also means that
539submitters need to submit the changes individually in the correct order.
540Otherwise it's likely that submissions fail due to conflicts or that the
541target branch gets broken (because it contains the submitted change, but not
542its predecessors which may be required for the submitted change to work
543correctly).
Edwin Kempind736da32022-07-27 12:41:05 +0200544+
Edwin Kempind2278ae2022-07-27 17:27:44 +0200545If link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`]
546is enabled changes that have the same topic are submitted together, the same as
547with all other submit actions. This means by setting the same topic on all
548dependent changes it's possible to submit a stack of changes together and
549overcome the limitation that change dependencies are ignored.
550+
551When cherry picking the patchset, Gerrit automatically appends onto the end of
552the commit message a short summary of the change's approvals, and a URL link
Edwin Kempinc5721b42022-08-03 15:03:01 +0200553back to the change in the web UI (see link:#submit-footers[below]).
Edwin Kempind2278ae2022-07-27 17:27:44 +0200554+
555Using this submit action is not recommended because it ignores change
556dependencies, instead link:#rebase_always[rebase always] should be used which
557behaves the same way except that it respects change dependencies (in particular
558`rebase always` adds the same kind of footers to the merged commit as
559`cherry pick`).
Edwin Kempind736da32022-07-27 12:41:05 +0200560
561--
562+
563[[submit_type_inherit]]
564In addition the submit action can be set to `Inherit`, which means that the
565value that is configured in the parent project applies. For new projects
566`Inherit` is the default, unless the default is overridden by the global
567link:config-gerrit.html#repository.name.defaultSubmitType[defaultSubmitType]
568configuration. Configuring `Inherit` for the `All-Projects` root project is
569equivalent to configuring link:#merge_if_necessary[merge if necessary].
570+
571If `submit.action` is not set, the default is 'merge if necessary'.
572+
Edwin Kempin95aff9e2022-08-03 15:41:42 +0200573NOTE: The different submit actions are also described in the
574link:https://docs.google.com/presentation/d/1C73UgQdzZDw0gzpaEqIC6SPujZJhqamyqO1XOHjH-uk/edit#slide=id.g4d6c16487b_1_800[Gerrit - Concepts and Workflows]
575presentation, where their behavior is visualized by git commit graphs.
576+
Edwin Kempin202fd4a2022-08-02 15:17:25 +0200577NOTE: If Gerrit performs a merge, rebase or cherry-pick as part of the
578change submission (true for all submit actions, except for
579link:#fast_forward_only[fast forward only]), it is controlled by the
580link:#submit.mergeContent[mergeContent] setting whether a content merge is
581performed when there is a path conflict.
582+
Edwin Kempind229dc32022-08-04 12:45:15 +0200583NOTE: If Gerrit performs a merge, rebase or cherry-pick as part of the
584change submission (true for all submit actions, except for
585link:#fast_forward_only[fast forward only]), it can be that trying to submit
586a change would fail due to Git conflicts (if the same lines were modified
587concurrently, or if link:#submit.mergeContent[mergeContent] is disabled also if
588the same files were modified concurrently). In this case the submit button in
589the Gerrit web UI is disabled and a tooltip on the disabled submit button
590informs about the change being non-mergeable.
591+
Edwin Kempinc5721b42022-08-03 15:03:01 +0200592[[submit-footers]]
593--
594NOTE: If Gerrit performs a rebase or cherry-pick as part of the change
595submission (true for link:#rebase_if_necessary[rebase if necessary],
596link:#rebase_always[rebase always] and link:#cherry_pick[cherry pick]) Gerrit
597inserts additional footers into the commit message of the newly created
598commit: +
599 +
600* `Change-Id: <change-id>` (only if this footer is not already present, see
601 link:user-changeid.html[Change-Id]) +
602* `Reviewed-on: <change-url>` (links to the change in Gerrit where this commit
603 was reviewed) +
604* `Reviewed-by: <reviewer>` (once for every reviewer with a positive
605 `Code-Review` vote) +
606* `Tested-by: <reviewer>` (once for every reviewer with a positive `Verified`
607 vote) +
608* `<label-name>: <reviewer>` (once for every reviewer with a positive vote on
609 any other label) +
Edwin Kempin318c3222022-08-03 15:32:38 +0200610 +
611In addition, plugins that implement a
612link:dev-plugins.html#change-message-modifier[Change Message Modifier] may add
613additional custom footers.
Edwin Kempinc5721b42022-08-03 15:03:01 +0200614--
615+
Edwin Kempind736da32022-07-27 12:41:05 +0200616NOTE: For the value of `submit.action` in `project.config` use the exact
617spelling as given above, e.g. 'merge if necessary' (without the single quotes,
618but with the spaces).
619+
620NOTE: Project owners can also set the submit action in the Gerrit UI:
621`Browse` > `Repositories` > my/repository > `Submit type`
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700622
Sven Selberg03946a62020-06-18 08:26:48 +0200623[[submit.matchAuthorToCommitterDate]]submit.matchAuthorToCommitterDate::
624+
625Defines whether the author date will be changed to match the submitter date upon submit, so that
626git log shows when the change was submitted instead of when the author last committed. Valid
627values are 'true', 'false', or 'INHERIT'. The default is 'INHERIT'. This option only takes effect
628in submit strategies which already modify the commit, i.e. Cherry Pick, Rebase Always, and
629(when rebase is necessary) Rebase If Necessary.
Patrick Hiesel5a316352017-06-22 15:38:06 +0200630
Sven Selberg03946a62020-06-18 08:26:48 +0200631[[submit.rejectEmptyCommit]]submit.rejectEmptyCommit::
632+
633Defines whether empty commits should be rejected when a change is merged. When using
634link:#submit.action[submit action] Cherry Pick, Rebase If Necessary or Rebase Always changes may
635become empty upon submit, since the rebase|cherry-pick can lead to an empty commit. If this option
636is set to 'true' the merge would fail in such a case. An empty commit is still allowed as the
637initial commit on a branch.
Patrick Hieseldc285c72018-01-08 17:20:15 +0100638
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700639
640[[access-section]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800641=== Access section
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700642
643Each +access+ section includes a reference and access rights connected
644to groups. Each group listed must exist in the link:#file-groups[+groups+ file].
645
646Please refer to the
647link:access-control.html#access_categories[Access Categories]
648documentation for a full list of available access rights.
649
650
Shawn Pearce9cfcebd2014-04-25 16:41:12 -0700651[[mimetype-section]]
652=== MIME Types section
653
654The +mimetype+ section may be configured to force the web code
655reviewer to return certain MIME types by file path. MIME types
656may be used to activate syntax highlighting.
657
658----
659[mimetype "text/x-c"]
660 path = *.pkt
661[mimetype "text/x-java"]
662 path = api/current.txt
663----
664
665
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700666[[capability-section]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800667=== Capability section
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700668
669The +capability+ section only appears once, and only in the +All-Projects+
670repository. It controls Gerrit administration capabilities that are configured
671on a global level.
672
673Please refer to the
674link:access-control.html#global_capabilities[Global Capabilities]
675documentation for a full list of available capabilities.
676
David Myllykangasb3ccec62015-01-21 15:41:13 +0100677[[label-section]]
678=== Label section
679
680Please refer to link:config-labels.html#label_custom[Custom Labels] documentation.
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700681
Youssef Elghareeb78287a42021-12-06 17:04:23 +0100682[[submit-requirement-section]]
683=== Submit Requirement section
684
685Please refer to link:config-submit-requirements.html[Configuring Submit
686Requirements] documentation.
687
Saša Živkov944b8382014-05-08 14:02:15 +0200688[[branchOrder-section]]
689=== branchOrder section
690
691Defines a branch ordering which is used for backporting of changes.
692Backporting will be offered for a change (in the Gerrit UI) for all
693more stable branches where the change can merge cleanly.
694
695[[branchOrder.branch]]branchOrder.branch::
696+
697A branch name, typically multiple values will be defined. The order of branch
698names in this section defines the branch order. The topmost is considered to be
699the least stable branch (typically the master branch) and the last one the
700most stable (typically the last maintained release branch).
Edwin Kempin677e7e62021-06-15 09:28:48 +0200701+
Saša Živkov944b8382014-05-08 14:02:15 +0200702Example:
Edwin Kempin677e7e62021-06-15 09:28:48 +0200703+
Saša Živkov944b8382014-05-08 14:02:15 +0200704----
705[branchOrder]
706 branch = master
707 branch = stable-2.9
708 branch = stable-2.8
709 branch = stable-2.7
710----
Edwin Kempin677e7e62021-06-15 09:28:48 +0200711+
Saša Živkov944b8382014-05-08 14:02:15 +0200712The `branchOrder` section is inheritable. This is useful when multiple or all
713projects follow the same branch rules. A `branchOrder` section in a child
714project completely overrides any `branchOrder` section from a parent i.e. there
715is no merging of `branchOrder` sections. A present but empty `branchOrder`
716section removes all inherited branch order.
Edwin Kempin677e7e62021-06-15 09:28:48 +0200717+
Saša Živkov944b8382014-05-08 14:02:15 +0200718Branches not listed in this section will not be included in the mergeability
719check. If the `branchOrder` section is not defined then the mergeability of a
720change into other branches will not be done.
721
Patrick Hiesel6db5afd2017-03-21 09:40:03 +0100722[[reviewer-section]]
723=== reviewer section
724
725Defines config options to adjust a project's reviewer workflow such as enabling
726reviewers and CCs by email.
727
728[[reviewer.enableByEmail]]reviewer.enableByEmail::
729+
730A boolean indicating if reviewers and CCs that do not currently have a Gerrit
731account can be added to a change by providing their email address.
Edwin Kempin677e7e62021-06-15 09:28:48 +0200732+
Edwin Kempine441f972022-02-08 15:22:08 +0100733This setting only takes effect for changes that are readable by anonymous users.
Edwin Kempin677e7e62021-06-15 09:28:48 +0200734+
Patrick Hiesel502b26c2017-03-29 14:19:23 +0200735Default is `INHERIT`, which means that this property is inherited from
736the parent project. If the property is not set in any parent project, the
737default value is `FALSE`.
Saša Živkov944b8382014-05-08 14:02:15 +0200738
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700739[[file-groups]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800740== The file +groups+
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700741
742Each group in this list is linked with its UUID so that renaming of
743groups is possible without having to rewrite every +groups+ file
744in every repository where it's used.
745
746This is what the default groups file for +All-Projects.git+ looks like:
747
748----
749# UUID Group Name
750#
7513d6da7dc4e99e6f6e5b5196e21b6f504fc530bba Administrators
752global:Anonymous-Users Anonymous Users
Khai Do5aaeee32014-09-05 10:14:32 -0700753global:Change-Owner Change Owner
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700754global:Project-Owners Project Owners
755global:Registered-Users Registered Users
756----
757
758This file can't be written to by the +git config+ command.
759
760In order to reference a group in +project.config+, it must be listed in
761the +groups+ file. When editing permissions through the web UI this
762file is maintained automatically, but when pushing updates to
763+refs/meta/config+ this must be dealt with by hand. Gerrit will refuse
764+project.config+ files that refer to groups not listed in +groups+.
765
766The UUID of a group can be found on the General tab of the group's page
767in the web UI or via the +-v+ option to
768link:cmd-ls-groups.html[the +ls-groups+ SSH command].
769
770
771[[file-rules_pl]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800772== The file +rules.pl+
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700773
774The +rules.pl+ files allows you to replace or amend the default Prolog
775rules that control e.g. what conditions need to be fulfilled for a
776change to be submittable. This file content should be
777interpretable by the 'Prolog Cafe' interpreter.
778
779You can read more about the +rules.pl+ file and the prolog rules on
780link:prolog-cookbook.html[the Prolog cookbook page].
781
David Pursehousee200d0d2019-06-05 12:08:19 +0900782GERRIT
783------
784Part of link:index.html[Gerrit Code Review]
785
786SEARCHBOX
787---------