
The Perfect Gerrit Patch A consumer report FOSDEM 2021 Stephan Bergmann Red Hat, Inc. 1 LibreOffice and Gerrit ● LibreOffice uses Gerrit for code review (https://gerrit.libreoffice.org ● !and "en#ins for testing (https://ci.libreoffice.org ● $an%t b&pass Gerrit ● !but can s#ip "en#ins' in an emergency 2 Gerrit jargon ● +ou upload a change for review ● Successive versions of a change are #nown as patch sets ● -ultiple changes can form a relation chain ● .hen &ou submit a change it beco(es a /real0 git co((it ) $onsumers of changes ● 2nitiall&' during review of an evolving change ● 3fter sub(itting: ● Post-facto review ● .hen the co((it is later found to cause an issue ● $o((enting on a change does not end once it gets sub(itted 1 .riting a change: 6eformatting, a recurring issue ● 3nd old' evolving code base following all #inds of different formatting st&les ● -ostl& readable *ust fine' though ● .hen changing e7isting code, avoid rando( refor(atting of unrelated code ● One line actuall& changed' but five additional lines refor(atted - if( foo< Bar >( baz )) + if (foo<Bar>(baz)) ● Distracts the reviewer ● $o(plicates use of tools li#e git blame or git log -S 5 .riting a change: 6eformatting, a recurring issue ● :ew files enforce clang-format to avoid later rando( reformatting ● Does not i(pl& e7isting code should be clang-format%ed ● clang-format does not (a#e the code (ore beautiful' or (ore readable, or! ● -erel& an e7tra (easure to avoid rando( refor(atting' used where applicable ● .hen (oving existing code to another file, retain the formatting ● 3dapt solenv/clang-format/excludelist ● ;elps tools li#e git log --follow 9 ,orting ● .hen adding to a list' #eep the list le7icographicall& sorted ● #include blocks' gb !ibrar" add exce#tion ob$ects' ! ● 3voids accidental duplicates ● 3voids (erge con=icts < Links to elsewhere ● .hen &ou reference another git co((it (in the co((it (essage, in a code co((ent' in a Gerrit co((ent ' give conte7t: ● %fa&&'&(%%'&)&a)*c+dbc*bdb),(b((a,(+da*+ -.se /.String01ar- ● ;elps identify the change if we ever switch ?$, ● ;elps hu(ans ● Sa(e for other lin#s' li#e bugzilla issues > Before &ou upload a change ● Test &our change locall& on at least one platfor( ● ma2e c1ec2 ● 3void --wit1out-$ava ● ?erify it covers the changed code ● --enable-werror ● 2nstall clang-for(at for the git co((it hoo# ● The loplugin warnings fro( "en#ins% gerritClinu7CclangCdbgutil li#el& suck ● Sorry about that ● +ou can locall& use $lang and --enable-com#iler-#lugins' too A 8uring review ● Use Gerrit co((ents to e7plain wh& &ou uploaded a new change set ● !in case that is not obvious ● Do not use the change%s co((it (essage for that ● Geep rebases separate fro( actual changes ● Though Gerrit tries to present a decent diff even then DE Poor "enkins ● "en#ins is a scarce resource ● 3void e7cessive nu(bers of patch sets ● Build locall& first ● 3void false relation chains a(ong Gerrit changes ● Expensive "en#ins rebuilds ● 3ccidentall& sub(itting out-of-order if it is a true relation chain after all DD Before &ou submit a change ● .ait for "en#ins% ?erifiedID ● 6esu(e upon spurious build failures ● 6ebase upon s&stematic issues with the parent ● Be careful about "en#ins% ?erifiedID ● 2f the "en#ins build is alread& a week old ● 6ebase once again ● 2f the change%s parent co((it is alread& a week old ● git #ull before &ou start to write a Gerrit change D2 Jull 8isclosure ● This was a rant ● But 2 love &ou all ● 3nd 2%ve (ade all the (ista#es (&self' too D).
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages13 Page
-
File Size-