Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
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:
2
3 - Make small logical changes.
4 - Provide a meaningful commit message.
5
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:
9
10 in *.jgit: 3-clause BSD
11 in *.egit: Eclipse Public License (EPL)
12
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:
16
17 maintainers: "Shawn O. Pearce" <spearce@spearce.org>
18 Robin Rosenberg <robin.rosenberg@dewire.com>
19
20 git list : git@vger.kernel.org
21
22
23 Long Version:
24
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.
29
30 However there are some differences, so please review and familiarize
31 yourself with the following relevant bits:
32
33
34 (1) Make separate commits for logically separate changes.
35
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.
41
42 Describe the technical detail of the change(s).
43
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.
46
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]").
51
52
53 (2) Generate your patch using git tools out of your commits.
54
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
57
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.
61
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.
66
67
68 (3) Sending your patches.
69
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.
77
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.
81
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.
90
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.
94
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.
104
105 Exception: If your mailer is mangling patches then someone may ask
106 you to re-send them using MIME, that is OK.
107
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.
114
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.
119
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.
125
126
127 (4) Check the license
128
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
130
131 * 3-clause (new-style) BSD,
132 * GNU Public License (GPL),
133 * GNU Lesser General Public License (LGPL),
134 * Eclipse Public License (EPL).
135
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
141
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.
146
147
148 (5) Sign your work
149
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.
154
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:
159
160 Developer's Certificate of Origin 1.1
161
162 By making a contribution to this project, I certify that:
163
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
167
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
175
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.
179
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.
186
187 then you just add a line saying
188
189 Signed-off-by: Random J Developer <random@developer.example.org>
190
191 This line can be automatically added by git if you run the git-commit
192 command with the -s option.
193
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.
197
198
199 ------------------------------------------------
200 MUA specific hints
201
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:
206
207 * Empty context lines that do not have _any_ whitespace.
208
209 * Non empty context lines that have one extra whitespace at the
210 beginning.
211
212 One test you could do yourself if your MUA is set up correctly is:
213
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.
217
218 * Save that patch to a file in UNIX mailbox format. Call it say
219 a.patch.
220
221 * Try to apply to the tip of the "master" branch from the
222 egit.git public repository:
223
224 $ git fetch git://repo.or.cz/egit.git master:test-apply
225 $ git checkout test-apply
226 $ git reset --hard
227 $ git am a.patch
228
229 If it does not apply correctly, there can be various reasons.
230
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.
234
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.
239
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.
248
249
250 Pine
251 ----
252
253 (Johannes Schindelin)
254
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.
258
259 ... the "no-strip-whitespace-before-send" option, too. AFAIK it
260 was introduced in 4.60.
261
262 (Linus Torvalds)
263
264 And 4.58 needs at least this.
265
266 ---
267 diff-tree 8326dd8350be64ac7fc805f6563a1d61ad10d32c (from e886a61f76edf5410573e92e38ce22974f9c40f1)
268 Author: Linus Torvalds <torvalds@g5.osdl.org>
269 Date: Mon Aug 15 17:23:51 2005 -0700
270
271 Fix pine whitespace-corruption bug
272
273 There's no excuse for unconditionally removing whitespace from
274 the pico buffers on close.
275
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;
288
289
290 (Daniel Barkalow)
291
292 > A patch to SubmittingPatches, MUA specific help section for
293 > users of Pine 4.63 would be very much appreciated.
294
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.
301
302
303 Thunderbird
304 -----------
305
306 (A Large Angry SCM)
307
308 Here are some hints on how to successfully submit patches inline using
309 Thunderbird.
310
311 This recipe appears to work with the current [*1*] Thunderbird from Suse.
312
313 The following Thunderbird extensions are needed:
314 AboutConfig 0.5
315 http://aboutconfig.mozdev.org/
316 External Editor 0.7.2
317 http://globs.org/articles.php?lng=en&pg=8
318
319 1) Prepare the patch as a text file using your method of choice.
320
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*]
325
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
331
332 4) Open a compose window and click the external editor icon.
333
334 5) In the external editor window, read in the patch file and exit the
335 editor normally.
336
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.
339
340 7) Optionally, undo the about:config/account settings changes made in
341 steps 2 & 3.
342
343
344 [Footnotes]
345 *1* Version 1.0 (20041207) from the MozillaThunderbird-1.0-5 rpm of Suse
346 9.3 professional updates.
347
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 mail.identity.id?.compose_html => false
353
354
355
356 Gnus
357 ----
358
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.
369
Something went wrong with that request. Please try again.