Shawn O. Pearce | e31d02c | 2009-12-08 12:21:37 -0800 | [diff] [blame] | 1 | Gerrit Code Review - Uploading Changes |
| 2 | ====================================== |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 3 | |
Shawn O. Pearce | 518fe3f | 2009-08-22 15:40:58 -0700 | [diff] [blame] | 4 | Gerrit supports three methods of uploading changes: |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 5 | |
| 6 | * Use `repo upload`, to create changes for review |
| 7 | * Use `git push`, to create changes for review |
| 8 | * Use `git push`, and bypass code review |
| 9 | |
Shawn O. Pearce | 518fe3f | 2009-08-22 15:40:58 -0700 | [diff] [blame] | 10 | All three methods rely on SSH public key authentication, which must |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 11 | first be configured by the uploading user. |
| 12 | |
Shawn O. Pearce | 518fe3f | 2009-08-22 15:40:58 -0700 | [diff] [blame] | 13 | SSH |
| 14 | --- |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 15 | |
Shawn O. Pearce | 518fe3f | 2009-08-22 15:40:58 -0700 | [diff] [blame] | 16 | Each user uploading changes to Gerrit must configure one or more SSH |
| 17 | public keys. The per-user SSH key list can be accessed over the web |
Edwin Kempin | b5df3b8 | 2011-10-10 11:31:14 +0200 | [diff] [blame] | 18 | within Gerrit by `Settings`, and then accessing the `SSH Public Keys` |
| 19 | tab. |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 20 | |
Shawn O. Pearce | 518fe3f | 2009-08-22 15:40:58 -0700 | [diff] [blame] | 21 | [[configure_ssh]] |
| 22 | Configuration |
| 23 | ~~~~~~~~~~~~~ |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 24 | |
Shawn O. Pearce | 518fe3f | 2009-08-22 15:40:58 -0700 | [diff] [blame] | 25 | To register a new SSH key for use with Gerrit, paste the contents of |
| 26 | your `id_rsa.pub` or `id_dsa.pub` file into the text box and click |
| 27 | the add button. Gerrit only understands SSH version 2 public keys. |
| 28 | Keys may be supplied in either the OpenSSH format (key starts with |
| 29 | `ssh-rsa` or `ssh-dss`) or the RFC 4716 format (file starts with |
| 30 | `---- BEGIN SSH2 PUBLIC KEY ----`). |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 31 | |
Shawn O. Pearce | 518fe3f | 2009-08-22 15:40:58 -0700 | [diff] [blame] | 32 | Typically SSH keys are stored in your home directory, under `~/.ssh`. |
| 33 | If you don't have any keys yet, you can create a new one and protect |
| 34 | it with a passphrase: |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 35 | |
| 36 | ==== |
| 37 | ssh-keygen -t rsa |
| 38 | ==== |
| 39 | |
| 40 | Then copy the content of the public key file onto your clipboard, |
| 41 | and paste it into Gerrit's web interface: |
| 42 | |
| 43 | ==== |
| 44 | cat ~/.ssh/id_rsa.pub |
| 45 | ==== |
| 46 | |
| 47 | [TIP] |
Shawn O. Pearce | 518fe3f | 2009-08-22 15:40:58 -0700 | [diff] [blame] | 48 | Users who frequently upload changes will also want to consider |
David Pursehouse | 221d4f6 | 2012-06-08 17:38:08 +0900 | [diff] [blame] | 49 | starting an `ssh-agent`, and adding their private key to the list |
Shawn O. Pearce | 518fe3f | 2009-08-22 15:40:58 -0700 | [diff] [blame] | 50 | managed by the agent, to reduce the frequency of entering the |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 51 | key's passphrase. Consult `man ssh-agent`, or your SSH client's |
| 52 | documentation, for more details on configuration of the agent |
| 53 | process and how to add the private key. |
| 54 | |
Shawn O. Pearce | 518fe3f | 2009-08-22 15:40:58 -0700 | [diff] [blame] | 55 | [[test_ssh]] |
| 56 | Testing Connections |
| 57 | ~~~~~~~~~~~~~~~~~~~ |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 58 | |
| 59 | To verify your SSH key is working correctly, try using an SSH client |
David Pursehouse | 221d4f6 | 2012-06-08 17:38:08 +0900 | [diff] [blame] | 60 | to connect to Gerrit's SSHD port. By default Gerrit runs on |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 61 | port 29418, using the same hostname as the web server: |
| 62 | |
| 63 | ==== |
Edwin Kempin | fb95a1b | 2011-10-05 10:08:00 +0200 | [diff] [blame] | 64 | .................................................................. |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 65 | $ ssh -p 29418 sshusername@hostname |
Edwin Kempin | fb95a1b | 2011-10-05 10:08:00 +0200 | [diff] [blame] | 66 | |
| 67 | **** Welcome to Gerrit Code Review **** |
| 68 | |
| 69 | Hi John Doe, you have successfully connected over SSH. |
| 70 | |
| 71 | Unfortunately, interactive shells are disabled. |
| 72 | To clone a hosted Git repository, use: |
| 73 | |
| 74 | git clone ssh://sshusername@hostname:29418/REPOSITORY_NAME.git |
| 75 | |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 76 | Connection to hostname closed. |
Edwin Kempin | fb95a1b | 2011-10-05 10:08:00 +0200 | [diff] [blame] | 77 | .................................................................. |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 78 | ==== |
| 79 | |
Edwin Kempin | fb95a1b | 2011-10-05 10:08:00 +0200 | [diff] [blame] | 80 | In the command above, `sshusername` was configured as `Username` on |
| 81 | the `Profile` tab of the `Settings` screen. If it is not set, |
| 82 | propose a name and use `Select Username` to select the name. |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 83 | |
| 84 | To determine the port number Gerrit is running on, visit the special |
| 85 | information URL `http://'hostname'/ssh_info`, and copy the port |
| 86 | number from the second field: |
| 87 | |
| 88 | ==== |
| 89 | $ curl http://hostname/ssh_info |
| 90 | hostname 29418 |
| 91 | ==== |
| 92 | |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 93 | If you are developing an automated tool to perform uploads to Gerrit, |
| 94 | let the user supply the hostname or the web address for Gerrit, |
| 95 | and obtain the port number on the fly from the `/ssh_info` URL. |
| 96 | The returned output from this URL is always `'hostname' SP 'port'`, |
Shawn O. Pearce | 518fe3f | 2009-08-22 15:40:58 -0700 | [diff] [blame] | 97 | or `NOT_AVAILABLE` if the SSHD server is not currently running. |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 98 | |
| 99 | |
Shawn O. Pearce | 518fe3f | 2009-08-22 15:40:58 -0700 | [diff] [blame] | 100 | git push |
| 101 | -------- |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 102 | |
Shawn O. Pearce | 518fe3f | 2009-08-22 15:40:58 -0700 | [diff] [blame] | 103 | [[push_create]] |
| 104 | Create Changes |
| 105 | ~~~~~~~~~~~~~~ |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 106 | |
David Pursehouse | 221d4f6 | 2012-06-08 17:38:08 +0900 | [diff] [blame] | 107 | To create new changes for review, simply push to the project's |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 108 | magical `refs/for/'branch'` ref using any Git client tool: |
| 109 | |
| 110 | ==== |
| 111 | git push ssh://sshusername@hostname:29418/projectname HEAD:refs/for/branchname |
| 112 | ==== |
| 113 | |
| 114 | E.g. `john.doe` can use git push to upload new changes for the |
| 115 | `experimental` branch of project `kernel/common`, hosted at the |
| 116 | `git.example.com` Gerrit server: |
| 117 | |
| 118 | ==== |
| 119 | git push ssh://john.doe@git.example.com:29418/kernel/common HEAD:refs/for/experimental |
| 120 | ==== |
| 121 | |
| 122 | Each new commit uploaded by the `git push` client will be |
| 123 | converted into a change record on the server. The remote ref |
| 124 | `refs/for/experimental` is not actually created by Gerrit, even |
| 125 | though the client's status messages may say otherwise. |
| 126 | |
| 127 | Other users (e.g. project owners) who have configured Gerrit to |
| 128 | notify them of new changes will be automatically sent an email |
| 129 | message when the push is completed. |
| 130 | |
Shawn O. Pearce | d50c94e | 2010-07-15 12:24:11 -0700 | [diff] [blame] | 131 | To include a short tag associated with all of the changes in the |
| 132 | same group, such as the local topic branch name, append it after |
| 133 | the destination branch name. In this example the short topic tag |
| 134 | 'driver/i42' will be saved on each change this push creates or |
| 135 | updates: |
| 136 | |
| 137 | ==== |
| 138 | git push ssh://john.doe@git.example.com:29418/kernel/common HEAD:refs/for/experimental/driver/i42 |
| 139 | ==== |
| 140 | |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 141 | If you are frequently uploading changes to the same Gerrit server, |
| 142 | consider adding an SSH host block in `~/.ssh/config` to remember |
| 143 | your username, hostname and port number. This permits the use of |
| 144 | shorter URLs on the command line, such as: |
| 145 | |
| 146 | ==== |
| 147 | $ cat ~/.ssh/config |
| 148 | ... |
| 149 | Host tr |
| 150 | Hostname git.example.com |
| 151 | Port 29418 |
| 152 | User john.doe |
| 153 | |
| 154 | $ git push tr:kernel/common HEAD:refs/for/experimental |
| 155 | ==== |
| 156 | |
Edwin Kempin | b5df3b8 | 2011-10-10 11:31:14 +0200 | [diff] [blame] | 157 | Specific reviewers can be requested and/or additional 'carbon |
| 158 | copies' of the notification message may be sent by including these |
Shawn O. Pearce | fc0ec2f | 2009-05-28 11:20:06 -0700 | [diff] [blame] | 159 | as arguments to `git receive-pack`: |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 160 | |
| 161 | ==== |
Shawn O. Pearce | fc0ec2f | 2009-05-28 11:20:06 -0700 | [diff] [blame] | 162 | git push --receive-pack='git receive-pack --reviewer=a@a.com --cc=b@o.com' tr:kernel/common HEAD:refs/for/experimental |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 163 | ==== |
| 164 | |
Edwin Kempin | cdb0e00 | 2011-09-08 14:23:30 +0200 | [diff] [blame] | 165 | The `--reviewer='email'` and `--cc='email'` options may be |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 166 | specified as many times as necessary to cover all interested |
| 167 | parties. Gerrit will automatically avoid sending duplicate email |
| 168 | notifications, such as if one of the specified reviewers or CC |
| 169 | addresses had also requested to receive all new change notifications. |
| 170 | |
| 171 | If you are frequently sending changes to the same parties and/or |
| 172 | branches, consider adding a custom remote block to your project's |
| 173 | `.git/config` file: |
| 174 | |
| 175 | ==== |
| 176 | $ cat .git/config |
| 177 | ... |
| 178 | [remote "for-a-exp"] |
| 179 | url = tr:kernel/common |
Shawn O. Pearce | fc0ec2f | 2009-05-28 11:20:06 -0700 | [diff] [blame] | 180 | receivepack = git receive-pack --reviewer=a@a.com --cc=b@o.com |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 181 | push = HEAD:refs/for/experimental |
| 182 | |
| 183 | $ git push for-a-exp |
| 184 | ==== |
| 185 | |
| 186 | |
Shawn O. Pearce | 518fe3f | 2009-08-22 15:40:58 -0700 | [diff] [blame] | 187 | [[push_replace]] |
| 188 | Replace Changes |
| 189 | ~~~~~~~~~~~~~~~ |
| 190 | |
| 191 | To add an additional patch set to a change, ensure Change-Id |
| 192 | lines were created in the original commit messages, and just use |
| 193 | `git push URL HEAD:refs/for/...` as <<push_create,described above>>. |
| 194 | Gerrit Code Review will automatically match the commits back to |
| 195 | their original changes by taking advantage of the Change-Id lines. |
| 196 | |
| 197 | If Change-Id lines are not present in the commit messages, consider |
| 198 | amending the message and copying the line from the change's page |
| 199 | on the web, and then using `git push` as described above. |
| 200 | |
| 201 | If Change-Id lines are not available, then the user must use the |
| 202 | manual mapping technique described below. |
| 203 | |
| 204 | For more about Change-Ids, see link:user-changeid.html[Change-Id Lines]. |
| 205 | |
Edwin Kempin | 930187e | 2011-01-27 10:13:42 +0100 | [diff] [blame] | 206 | [[manual_replacement_mapping]] |
Edwin Kempin | b2e42c8 | 2011-01-13 09:29:57 +0100 | [diff] [blame] | 207 | Manual Replacement Mapping |
| 208 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
Shawn O. Pearce | 518fe3f | 2009-08-22 15:40:58 -0700 | [diff] [blame] | 209 | |
| 210 | .Deprecation Warning |
| 211 | **** |
| 212 | The remainder of this section describes a manual method of replacing |
| 213 | changes by matching each commit name to an existing change number. |
| 214 | End-users should instead prefer to use Change-Id lines in their |
| 215 | commit messages, as the process is then fully automated by Gerrit |
| 216 | during normal uploads. |
| 217 | |
| 218 | See above for the preferred technique of replacing changes. |
| 219 | **** |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 220 | |
| 221 | To add an additional patch set to a change, replacing it with an |
| 222 | updated version of the same logical modification, send the new |
| 223 | commit to the change's ref. For example, to add the commit whose |
| 224 | SHA-1 starts with `c0ffee` as a new patch set for change number |
| 225 | `1979`, use the push refspec `c0ffee:refs/changes/1979` as below: |
| 226 | |
| 227 | ==== |
| 228 | git push ssh://sshusername@hostname:29418/projectname c0ffee:refs/changes/1979 |
| 229 | ==== |
| 230 | |
| 231 | This form can be combined together with `refs/for/'branchname'` |
| 232 | (above) to simultaneously create new changes and replace changes |
| 233 | during one network transaction. |
| 234 | |
| 235 | For example, consider the following sequence of events: |
| 236 | |
| 237 | ==== |
| 238 | $ git commit -m A ; # create 3 commits |
| 239 | $ git commit -m B |
| 240 | $ git commit -m C |
| 241 | |
| 242 | $ git push ... HEAD:refs/for/master ; # upload for review |
| 243 | ... A is 1500 ... |
| 244 | ... B is 1501 ... |
| 245 | ... C is 1502 ... |
| 246 | |
| 247 | $ git rebase -i HEAD~3 ; # edit "A", insert D before B |
| 248 | ; # now series is A'-D-B'-C' |
Shawn O. Pearce | d607846 | 2009-11-02 10:37:01 -0800 | [diff] [blame] | 249 | $ git push ... |
| 250 | HEAD:refs/for/master |
| 251 | HEAD~3:refs/changes/1500 |
| 252 | HEAD~1:refs/changes/1501 |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 253 | HEAD~0:refs/changes/1502 ; # upload replacements |
| 254 | ==== |
| 255 | |
| 256 | At the final step during the push Gerrit will attach A' as a new |
| 257 | patch set on change 1500; B' as a new patch set on change 1501; C' |
| 258 | as a new patch set on 1502; and D will be created as a new change. |
| 259 | |
| 260 | Ensuring D is created as a new change requires passing the refspec |
| 261 | `HEAD:refs/for/branchname`, otherwise Gerrit will ignore D and |
| 262 | won't do anything with it. For this reason it is a good idea to |
| 263 | always include the create change refspec when uploading replacements. |
| 264 | |
| 265 | |
Edwin Kempin | 913eab1 | 2011-05-06 08:18:24 +0200 | [diff] [blame] | 266 | [[bypass_review]] |
Shawn O. Pearce | 518fe3f | 2009-08-22 15:40:58 -0700 | [diff] [blame] | 267 | Bypass Review |
| 268 | ~~~~~~~~~~~~~ |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 269 | |
| 270 | Changes (and annotated tags) can be pushed directly into a |
| 271 | repository, bypassing the review process. This is primarily useful |
| 272 | for a project owner to create new branches, create annotated tags |
| 273 | for releases, or to force-update a branch whose history needed to |
| 274 | be rewritten. |
| 275 | |
| 276 | Gerrit restricts direct pushes that bypass review to: |
| 277 | |
| 278 | * `refs/heads/*`: any branch can be updated, created, deleted, |
| 279 | or rewritten by the pusher. |
| 280 | * `refs/tags/*`: annotated tag objects pointing to any other type |
Nico Sallembien | 950e415 | 2010-03-16 15:45:33 -0700 | [diff] [blame] | 281 | of Git object can be created. |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 282 | |
Fredrik Luthander | c10f9e7 | 2012-01-23 17:00:45 +0100 | [diff] [blame] | 283 | To push branches, the proper access rights must be configured first. |
| 284 | Here follows a few examples of how to configure this in Gerrit: |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 285 | |
| 286 | * Update: Any existing branch can be fast-forwarded to a new commit. |
| 287 | This is the safest mode as commits cannot be discarded. Creation |
Fredrik Luthander | c10f9e7 | 2012-01-23 17:00:45 +0100 | [diff] [blame] | 288 | of new branches is rejected. Can be configured with |
| 289 | link:access-control.html#category_push_direct['Push'] access. |
| 290 | * Create: Allows creation of a new branch if the name does not |
| 291 | already designate an existing branch name. Needs |
| 292 | link:access-control.html#category_create['Create Reference'] |
| 293 | configured. Please note that once created, this permission doesn't |
| 294 | grant the right to update the branch with further commits (see above |
| 295 | for update details). |
| 296 | * Delete: Implies Update, but also allows an existing |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 297 | branch to be deleted. Since a force push is effectively a delete |
| 298 | followed by a create, but performed atomically on the server and |
| 299 | logged, this also permits forced push updates to branches. |
Fredrik Luthander | c10f9e7 | 2012-01-23 17:00:45 +0100 | [diff] [blame] | 300 | To grant this access, configure |
| 301 | link:access-control.html#category_push_direct['Push'] with the |
| 302 | 'Force' option ticked. |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 303 | |
| 304 | To push annotated tags, the `Push Annotated Tag` project right must |
| 305 | be granted to one (or more) of the user's groups. There is only |
| 306 | one level of access in this category. |
| 307 | |
| 308 | Project owners may wish to grant themselves `Push Annotated Tag` |
| 309 | only at times when a new release is being prepared, and otherwise |
| 310 | grant nothing at all. This ensures that accidental pushes don't |
| 311 | make undesired changes to the public repository. |
| 312 | |
| 313 | |
Shawn O. Pearce | 518fe3f | 2009-08-22 15:40:58 -0700 | [diff] [blame] | 314 | repo upload |
| 315 | ----------- |
| 316 | |
| 317 | repo is a multiple repository management tool, most commonly |
| 318 | used by the Android Open Source Project. For more details, see |
| 319 | link:http://source.android.com/download/using-repo[using repo]. |
| 320 | |
| 321 | [[repo_create]] |
| 322 | Create Changes |
| 323 | ~~~~~~~~~~~~~~ |
| 324 | |
| 325 | To upload changes to a project using `repo`, ensure the manifest's |
| 326 | review field has been configured to point to the Gerrit server. |
| 327 | Only the hostname or the web address needs to be given in the |
| 328 | manifest file. During upload `repo` will automatically determine the |
| 329 | correct port number by reading `http://'reviewhostname'/ssh_info` |
| 330 | when its invoked. |
| 331 | |
| 332 | Each new commit uploaded by `repo upload` will be converted into |
| 333 | a change record on the server. Other users (e.g. project owners) |
| 334 | who have configured Gerrit to notify them of new changes will be |
| 335 | automatically sent an email message. Additional notifications can |
| 336 | be sent through command line options. |
| 337 | |
| 338 | For more details on using `repo upload`, see `repo help upload`. |
| 339 | |
| 340 | [[repo_replace]] |
| 341 | Replace Changes |
| 342 | ~~~~~~~~~~~~~~~ |
| 343 | |
| 344 | To replace changes, ensure Change-Id lines were created in the |
Cecilia Svensson | cd2491d | 2012-01-20 14:22:30 +0100 | [diff] [blame] | 345 | commit messages, and just use `repo upload`. |
| 346 | Gerrit Code Review will automatically match the commits back to |
| 347 | their original changes by taking advantage of their Change-Id lines. |
Shawn O. Pearce | 518fe3f | 2009-08-22 15:40:58 -0700 | [diff] [blame] | 348 | |
| 349 | If Change-Id lines are not present in the commit messages, consider |
| 350 | amending the message and copying the line from the change's page |
| 351 | on the web. |
| 352 | |
| 353 | If Change-Id lines are not available, then the user must use the much |
Cecilia Svensson | cd2491d | 2012-01-20 14:22:30 +0100 | [diff] [blame] | 354 | more <<manual_replacement_mapping,manual mapping technique>> offered |
| 355 | by using `git push` to a specific `refs/changes/change#` reference. |
Shawn O. Pearce | 518fe3f | 2009-08-22 15:40:58 -0700 | [diff] [blame] | 356 | |
| 357 | For more about Change-Ids, see link:user-changeid.html[Change-Id Lines]. |
| 358 | |
| 359 | |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 360 | Gritty Details |
| 361 | -------------- |
| 362 | |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 363 | As Gerrit implements the entire SSH and Git server stack within its |
| 364 | own process space, Gerrit maintains complete control over how the |
| 365 | repository is updated, and what responses are sent to the `git push` |
| 366 | client invoked by the end-user, or by `repo upload`. This allows |
Edwin Kempin | cdb0e00 | 2011-09-08 14:23:30 +0200 | [diff] [blame] | 367 | Gerrit to provide magical refs, such as `refs/for/*` for new |
| 368 | change submission and `refs/changes/*` for change replacement. |
Shawn O. Pearce | e61a3c6 | 2009-01-29 08:42:41 -0800 | [diff] [blame] | 369 | When a push request is received to create a ref in one of these |
| 370 | namespaces Gerrit performs its own logic to update the database, |
| 371 | and then lies to the client about the result of the operation. |
| 372 | A successful result causes the client to believe that Gerrit has |
| 373 | created the ref, but in reality Gerrit hasn't created the ref at all. |
| 374 | |
| 375 | By implementing the entire server stack, Gerrit is also able to |
| 376 | perform project level access control checks (to verify the end-user |
| 377 | is permitted to access a project) prior to advertising the available |
| 378 | refs, and potentially leaking information to a snooping client. |
| 379 | Clients cannot tell the difference between 'project not found' and |
| 380 | 'project exists, but access is denied'. |
| 381 | |
| 382 | Gerrit can also ensure users have completed a valid Contributor |
| 383 | Agreement prior to accepting any transferred objects, and if an |
| 384 | agreement is required, but not completed, it aborts the network |
| 385 | connection before data is sent. This ensures that project owners |
| 386 | can be certain any object available in their repository has been |
| 387 | supplied under at least one valid agreement. |
Shawn O. Pearce | 5500e69 | 2009-05-28 15:55:01 -0700 | [diff] [blame] | 388 | |
| 389 | GERRIT |
| 390 | ------ |
| 391 | Part of link:index.html[Gerrit Code Review] |