Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

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