Cleanup RevWalk.parseTree semantics
[egit/fonseca.git] / SUBMITTING_PATCHES
blobe4a135e1debe2bd689e4eab8189f31d3ad6746f4
1 I wanted a file describing how to submit patches for egit/jgit,
2 so I started with the one found in the core Git distribution
3 (Documentation/SubmittingPatches), which itself was based on the
4 patch submission guidelines for the Linux kernel.
6 However there are some differences, so please review and familiarize
7 yourself with the following relevant bits:
10 (1) Make separate commits for logically separate changes.
12 Unless your patch is really trivial, you should not be sending
13 out a patch that was generated between your working tree and your
14 commit head.  Instead, always make a commit with complete commit
15 message and generate a series of patches from your repository.
16 It is a good discipline.
18 Describe the technical detail of the change(s).
20 If your description starts to get too long, that's a sign that you
21 probably need to split up your commit to finer grained pieces.
23 I am very picky about formatting.  Make sure your final version
24 of every file was formatted using the Eclipse code formatter
25 using the project specific settings (Properties->Java Code
26 Style->Formatter->"Java Conventions [built-in]").
29 (2) Generate your patch using git tools out of your commits.
31 git based diff tools (git, Cogito, and StGIT included) generate
32 unidiff which is the preferred format.
34 You do not have to be afraid to use -M option to "git diff" or "git
35 format-patch", if your patch involves file renames.  The receiving
36 end can handle them just fine.
38 Please make sure your patch does not include any extra files which
39 do not belong in a patch submission.  Make sure to review your
40 patch after generating it, to ensure accuracy.  Before sending out,
41 please make sure it cleanly applies to the "master" branch head.
44 (3) Sending your patches.
46 People on the git mailing list need to be able to read and comment
47 on the changes you are submitting.  It is important for a developer
48 to be able to "quote" your changes, using standard e-mail tools, so
49 that they may comment on specific portions of your code.  For this
50 reason, all patches should be submitted "inline".  WARNING: Be wary
51 of your MUAs word-wrap corrupting your patch.  Do not cut-n-paste
52 your patch; you can lose tabs that way if you are not careful.
54 It is a common convention to prefix your subject line with [PATCH].
55 This lets people easily distinguish patches from other e-mail
56 discussions.
58 "git format-patch" command follows the best current practice to
59 format the body of an e-mail message.  At the beginning of the patch
60 should come your commit message, ending with the Signed-off-by:
61 lines, and a line that consists of three dashes, followed by the
62 diffstat information and the patch itself.  If you are forwarding a
63 patch from somebody else, optionally, at the beginning of the e-mail
64 message just before the commit message starts, you can put a "From:
65 " line to name that person.
67 You often want to add additional explanation about the patch,
68 other than the commit message itself.  Place such "cover letter"
69 material between the three dash lines and the diffstat.
71 Do not attach the patch as a MIME attachment, compressed or not.
72 Do not let your e-mail client send quoted-printable.  Do not let your
73 e-mail client send format=flowed which would destroy whitespaces
74 in your patches. Many popular e-mail applications will not always
75 transmit a MIME attachment as plain text, making it impossible to
76 comment on your code.  A MIME attachment also takes a bit more
77 time to process.  This does not decrease the likelihood of your
78 MIME-attached change being accepted, but it makes it more likely
79 that it will be postponed.
81 Exception:  If your mailer is mangling patches then someone may ask
82 you to re-send them using MIME, that is OK.
84 Do not PGP sign your patch, at least for now.  Most likely, your
85 maintainer or other people on the list would not have your PGP
86 key and would not bother obtaining it anyway.  Your patch is not
87 judged by who you are; a good patch from an unknown origin has a
88 far better chance of being accepted than a patch from a known,
89 respected origin that is done poorly or does incorrect things.
91 If you really really really really want to do a PGP signed
92 patch, format it as "multipart/signed", not a text/plain message
93 that starts with '-----BEGIN PGP SIGNED MESSAGE-----'.  That is
94 not a text/plain, it's something else.
96 Note that your maintainer does not necessarily read everything
97 on the git mailing list.  If your patch is for discussion first,
98 send it "To:" the mailing list, and optionally "cc:" him.  If it
99 is trivially correct or after the list reached a consensus, send it
100 "To:" the maintainer and optionally "cc:" the list.
103 (4) Check the license
105 Some parts of egit/jgit are licensed under one of the:
107  * 3-clause (new-style) BSD,
108  * GNU Public License (GPL),
109  * GNU Lesser General Public License (LGPL),
110  * Eclipse Public License (EPL).
112 Because of this split licensing model *every* file within the project
113 *must* list which license covers it in the header of the file.
114 Any new contributions to an existing file *must* be submitted under
115 the current license of that file.  Any new files *must* clearly
116 indicate which license they are provided under in the file header.
118 Please verify that you are legally allowed and willing to submit your
119 changes under the license covering each file *prior* to submitting
120 your patch.  It is virtually impossible to remove a patch once it
121 has been applied and pushed out.
124 (5) Sign your work
126 To improve tracking of who did what, we've borrowed the "sign-off"
127 procedure from the Linux kernel project on patches that are being
128 emailed around.  Although egit/jgit is a lot smaller project it is
129 a good discipline to follow it.
131 The sign-off is a simple line at the end of the explanation for the
132 patch, which certifies that you wrote it or otherwise have the right
133 to pass it on as a open-source patch.  The rules are pretty simple:
134 if you can certify the below:
136         Developer's Certificate of Origin 1.1
138         By making a contribution to this project, I certify that:
140         (a) The contribution was created in whole or in part by me
141             and I have the right to submit it under the open source
142             license indicated in the file; or
144         (b) The contribution is based upon previous work that, to the
145             best of my knowledge, is covered under an appropriate
146             open source license and I have the right under that
147             license to submit that work with modifications, whether
148             created in whole or in part by me, under the same open
149             source license (unless I am permitted to submit under
150             a different license), as indicated in the file; or
152         (c) The contribution was provided directly to me by some
153             other person who certified (a), (b) or (c) and I have
154             not modified it.
156         (d) I understand and agree that this project and the
157             contribution are public and that a record of the
158             contribution (including all personal information I
159             submit with it, including my sign-off) is maintained
160             indefinitely and may be redistributed consistent with
161             this project or the open source license(s) involved.
163 then you just add a line saying
165         Signed-off-by: Random J Developer <random@developer.example.org>
167 This line can be automatically added by git if you run the git-commit
168 command with the -s option.
170 Some people also put extra tags at the end.  They'll just be ignored
171 for now, but you can do this to mark internal company procedures
172 or just point out some special detail about the sign-off.
175 ------------------------------------------------
176 MUA specific hints
178 Some of patches I receive or pick up from the list share common
179 patterns of breakage.  Please make sure your MUA is set up
180 properly not to corrupt whitespaces.  Here are two common ones
181 I have seen:
183 * Empty context lines that do not have _any_ whitespace.
185 * Non empty context lines that have one extra whitespace at the
186   beginning.
188 One test you could do yourself if your MUA is set up correctly is:
190 * Send the patch to yourself, exactly the way you would, except
191   To: and Cc: lines, which would not contain the list and
192   maintainer address.
194 * Save that patch to a file in UNIX mailbox format.  Call it say
195   a.patch.
197 * Try to apply to the tip of the "master" branch from the
198   egit.git public repository:
200     $ git fetch git://repo.or.cz/egit.git master:test-apply
201     $ git checkout test-apply
202     $ git reset --hard
203     $ git am a.patch
205 If it does not apply correctly, there can be various reasons.
207 * Your patch itself does not apply cleanly.  That is _bad_ but
208   does not have much to do with your MUA.  Please rebase the
209   patch appropriately.
211 * Your MUA corrupted your patch; applymbox would complain that
212   the patch does not apply.  Look at .dotest/ subdirectory and
213   see what 'patch' file contains and check for the common
214   corruption patterns mentioned above.
216 * While you are at it, check what are in 'info' and
217   'final-commit' files as well.  If what is in 'final-commit' is
218   not exactly what you would want to see in the commit log
219   message, it is very likely that your maintainer would end up
220   hand editing the log message when he applies your patch.
221   Things like "Hi, this is my first patch.\n", if you really
222   want to put in the patch e-mail, should come after the
223   three-dash line that signals the end of the commit message.
226 Pine
227 ----
229 (Johannes Schindelin)
231 I don't know how many people still use pine, but for those poor
232 souls it may be good to mention that the quell-flowed-text is
233 needed for recent versions.
235 ... the "no-strip-whitespace-before-send" option, too. AFAIK it
236 was introduced in 4.60.
238 (Linus Torvalds)
240 And 4.58 needs at least this.
243 diff-tree 8326dd8350be64ac7fc805f6563a1d61ad10d32c (from e886a61f76edf5410573e92e38ce22974f9c40f1)
244 Author: Linus Torvalds <torvalds@g5.osdl.org>
245 Date:   Mon Aug 15 17:23:51 2005 -0700
247     Fix pine whitespace-corruption bug
249     There's no excuse for unconditionally removing whitespace from
250     the pico buffers on close.
252 diff --git a/pico/pico.c b/pico/pico.c
253 --- a/pico/pico.c
254 +++ b/pico/pico.c
255 @@ -219,7 +219,9 @@ PICO *pm;
256             switch(pico_all_done){      /* prepare for/handle final events */
257               case COMP_EXIT :          /* already confirmed */
258                 packheader();
259 +#if 0
260                 stripwhitespace();
261 +#endif
262                 c |= COMP_EXIT;
263                 break;
266 (Daniel Barkalow)
268 > A patch to SubmittingPatches, MUA specific help section for
269 > users of Pine 4.63 would be very much appreciated.
271 Ah, it looks like a recent version changed the default behavior to do the
272 right thing, and inverted the sense of the configuration option. (Either
273 that or Gentoo did it.) So you need to set the
274 "no-strip-whitespace-before-send" option, unless the option you have is
275 "strip-whitespace-before-send", in which case you should avoid checking
279 Thunderbird
280 -----------
282 (A Large Angry SCM)
284 Here are some hints on how to successfully submit patches inline using
285 Thunderbird.
287 This recipe appears to work with the current [*1*] Thunderbird from Suse.
289 The following Thunderbird extensions are needed:
290         AboutConfig 0.5
291                 http://aboutconfig.mozdev.org/
292         External Editor 0.7.2
293                 http://globs.org/articles.php?lng=en&pg=8
295 1) Prepare the patch as a text file using your method of choice.
297 2) Before opening a compose window, use Edit->Account Settings to
298 uncheck the "Compose messages in HTML format" setting in the
299 "Composition & Addressing" panel of the account to be used to send the
300 patch. [*2*]
302 3) In the main Thunderbird window, _before_ you open the compose window
303 for the patch, use Tools->about:config to set the following to the
304 indicated values:
305         mailnews.send_plaintext_flowed  => false
306         mailnews.wraplength             => 0
308 4) Open a compose window and click the external editor icon.
310 5) In the external editor window, read in the patch file and exit the
311 editor normally.
313 6) Back in the compose window: Add whatever other text you wish to the
314 message, complete the addressing and subject fields, and press send.
316 7) Optionally, undo the about:config/account settings changes made in
317 steps 2 & 3.
320 [Footnotes]
321 *1* Version 1.0 (20041207) from the MozillaThunderbird-1.0-5 rpm of Suse
322 9.3 professional updates.
324 *2* It may be possible to do this with about:config and the following
325 settings but I haven't tried, yet.
326         mail.html_compose                       => false
327         mail.identity.default.compose_html      => false
328         mail.identity.id?.compose_html          => false
332 Gnus
333 ----
335 '|' in the *Summary* buffer can be used to pipe the current
336 message to an external program, and this is a handy way to drive
337 "git am".  However, if the message is MIME encoded, what is
338 piped into the program is the representation you see in your
339 *Article* buffer after unwrapping MIME.  This is often not what
340 you would want for two reasons.  It tends to screw up non ASCII
341 characters (most notably in people's names), and also
342 whitespaces (fatal in patches).  Running 'C-u g' to display the
343 message in raw form before using '|' to run the pipe can work
344 this problem around.