Gerrit Submodules Support
OBSOLETE CONTENT
This wiki has been archived and the content is no longer updated. Please visit git-scm.com/doc for up-to-date documentation.
Contents |
Gerrit Submodules Support
Below is a short description of how to use the submodule support in Gerrit.
Configure Gerrit
It is important that the gerrit.canonicalWebUrl is set to a proper value since this used to figure out if a push should be sent to the subscribing superprojects. In the example below the gerrit block looks like this:
[gerrit] canonicalWebUrl = http://localhost/ basePath = git
Create projects
You need to create subprojects and a super project:
$ ssh user@gerrit -p 29418 gerrit create-project --name super --empty-commit $ ssh user@gerrit -p 29418 gerrit create-project --name a --empty-commit $ ssh user@gerrit -p 29418 gerrit create-project --name b --empty-commit
Connect projects
Add the subprojects to the super project:
$ git submodule add ssh://localhost/a ./a $ git submodule add ssh://localhost/b ./b
edit the .gitmodules file
add revision=.
:
[submodule "a"] path = a url = ssh://localhost/a revision = . [submodule "b"] path = b url = ssh://localhost/b revision = .
Push to server
Add, commit and push the .gitmodules file:
$ git commit add .gitmodules<br> $ git push ssh://localhost/super HEAD:refs/heads/master
Test that it works.
Now the basic setup is done. To test that everything is working:
$ mkdir user1 $ cd user1 $ git clone ssh://localhost/super $ cd super $ git submodule init $ git submodule update
do the same for a user2:
$ cd ../.. $mkdir user2 $ cd user2 $ git clone ssh://localhost/super $ cd super $ git submodule init $ git submodule update
Create a commit
Create a commit in a submodule:
$ cd a $ touch hello $ git add hello $ git commit -m "hello" $ git push ssh://localhost/a HEAD:refs/heads/master
move into the user1 directory again and pull the superproject:
cd ../../user1 git pull git submodule update ls a
make sure that the hello file is in the output.
Notes on possible "buildbot" verification implementation
- Poll for changes going into the super project
- Check approval status of all changes in the super project (ask, "can i verify this?")
- Pulling into the super project we'll get a merge commit (possibly)
- Verify that tree
- Upon success:
- Upload the superproject merge commit
- Set verified and merge all submodule changes and all superproject changes in a single 'review' command
-
ssh -p 29418 review.example.com gerrit review --verified=+1 --submit sub1-commit-id,sub2-commit-id,super-commit-id
-