5. Serving Git Repositories with JGit
JGit daemon
GitBlit
Download and configure GitBlit GO
Initialize certs
$ java -jar authority.jar --baseFolder data
Start server
$ java -jar gitblit.jar --baseFolder data
6. GitBlit - Git server
GitBlit is a Git server based on JGit
http://gitblit.com/
• http daemon using JGit’s GitServlet
• nice UI
• user management
• simple access control
• Lucene based search
Next GitBlit version 1.3 will use JGit 3.0
Demo
7. Serving Git Repositories with JGit
JGit daemon
GitBlit
Gerrit
Initialize and configure
$ java –jar gerrit.war init -d gerrit_site
Start server
$ ./gerrit_site/bin/gerrit.sh start
8. Code Review with Git and Gerrit
Gerrit is a Code Review system based on JGit
http://code.google.com/p/gerrit/
Serves as a Git server
• http and ssh daemon
• access control
• customizable code review workflow
• plugins (also GitBlit)
Gerrit 2.6 uses JGit 3.0
Demo
10. Serving faster
Clone and Fetch Performance
Typically dominated by "Counting: ..." phase
Cost is linear with complexity and age of repository
Linux kernel: 2.9M objects, 100% server CPU
60s counting time
JGit Bitmap Indexes
Pre-computed reachability data for commits in a pack file
Linux kernel bitmap data: 2.9 MiB (for 559 MiB pack, 78 MiB idx)
<80ms counting time
ignored by native git
ships in JGit 3.0 and Gerrit Code Review 2.6
11. Bitmap structure
- Assign bits by order of objects in pack file
- Objects to send = want AND_NOT have
- Bitmaps are compressible
- EWAH bitmap, variant of RLE
Daniel Lemire, Owen Kaser, Kamel Aouiche,
Sorting improves word-aligned bitmap indexes,
Data & Knowledge Engineering, Volume 69, Issue 1, 2010
12. The Race - serving faster
Run JGit’s GC to create bitmap index
$ jgit --git-dir . debug-gc using JGit CLI
$ ssh -p 29418 localhost gerrit gc linux using Gerrit CLI
Race against native git daemon
which does not (yet) understand bitmap index
Demo
13. Recursive Merge
- Can merge more complex version graphs
- e.g. criss-cross merges
- is now the default like in native git
master fix1
2 common base versions
How to merge branch fix1 ?
14. Other new EGit stuff
Rename detection in history view and commit
editor
15. Other new EGit stuff
Reset to
expression
e.g. commit-id,
HEAD^ ...
Show the gitblit UIRepositoriesUsers/TeamsPermissionsSearch
Show the UI- Do a comment
Show the UI- Do a comment
Maybe
Maybe
DemoExplain daemonsStart themStart cgit cloneStart jgit cloneExplain that „receiving objects“ and „resolving deltas“ is bound by network and client side processing