Improved keyboard handling of CommitDialog
[egit/egit-new.git] / SUBMITTING_PATCHES
blobd4c274c525122d45c19d0920a377b648b97d2343
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 the GNU Public License
106 (GPL), GNU Lesser General Public License (LGPL), and others under
107 the Eclipse Public License (EPL).  Because of this split licensing
108 model *every* file within the project *must* list which license
109 covers it in the header of the file.  Any new contributions to an
110 existing file *must* be submitted under the current license of
111 that file.  Any new files *must* clearly indicate which license
112 they are provided under in the file header.
114 Please verify that you are legally allowed and willing to submit your
115 changes under the license covering each file *prior* to submitting
116 your patch.  It is virtually impossible to remove a patch once it
117 has been applied and pushed out.
120 (5) Sign your work
122 To improve tracking of who did what, we've borrowed the "sign-off"
123 procedure from the Linux kernel project on patches that are being
124 emailed around.  Although egit/jgit is a lot smaller project it is
125 a good discipline to follow it.
127 The sign-off is a simple line at the end of the explanation for the
128 patch, which certifies that you wrote it or otherwise have the right
129 to pass it on as a open-source patch.  The rules are pretty simple:
130 if you can certify the below:
132         Developer's Certificate of Origin 1.1
134         By making a contribution to this project, I certify that:
136         (a) The contribution was created in whole or in part by me
137             and I have the right to submit it under the open source
138             license indicated in the file; or
140         (b) The contribution is based upon previous work that, to the
141             best of my knowledge, is covered under an appropriate
142             open source license and I have the right under that
143             license to submit that work with modifications, whether
144             created in whole or in part by me, under the same open
145             source license (unless I am permitted to submit under
146             a different license), as indicated in the file; or
148         (c) The contribution was provided directly to me by some
149             other person who certified (a), (b) or (c) and I have
150             not modified it.
152         (d) I understand and agree that this project and the
153             contribution are public and that a record of the
154             contribution (including all personal information I
155             submit with it, including my sign-off) is maintained
156             indefinitely and may be redistributed consistent with
157             this project or the open source license(s) involved.
159 then you just add a line saying
161         Signed-off-by: Random J Developer <random@developer.example.org>
163 This line can be automatically added by git if you run the git-commit
164 command with the -s option.
166 Some people also put extra tags at the end.  They'll just be ignored
167 for now, but you can do this to mark internal company procedures
168 or just point out some special detail about the sign-off.
171 ------------------------------------------------
172 MUA specific hints
174 Some of patches I receive or pick up from the list share common
175 patterns of breakage.  Please make sure your MUA is set up
176 properly not to corrupt whitespaces.  Here are two common ones
177 I have seen:
179 * Empty context lines that do not have _any_ whitespace.
181 * Non empty context lines that have one extra whitespace at the
182   beginning.
184 One test you could do yourself if your MUA is set up correctly is:
186 * Send the patch to yourself, exactly the way you would, except
187   To: and Cc: lines, which would not contain the list and
188   maintainer address.
190 * Save that patch to a file in UNIX mailbox format.  Call it say
191   a.patch.
193 * Try to apply to the tip of the "master" branch from the
194   egit.git public repository:
196     $ git fetch git://repo.or.cz/egit.git master:test-apply
197     $ git checkout test-apply
198     $ git reset --hard
199     $ git am a.patch
201 If it does not apply correctly, there can be various reasons.
203 * Your patch itself does not apply cleanly.  That is _bad_ but
204   does not have much to do with your MUA.  Please rebase the
205   patch appropriately.
207 * Your MUA corrupted your patch; applymbox would complain that
208   the patch does not apply.  Look at .dotest/ subdirectory and
209   see what 'patch' file contains and check for the common
210   corruption patterns mentioned above.
212 * While you are at it, check what are in 'info' and
213   'final-commit' files as well.  If what is in 'final-commit' is
214   not exactly what you would want to see in the commit log
215   message, it is very likely that your maintainer would end up
216   hand editing the log message when he applies your patch.
217   Things like "Hi, this is my first patch.\n", if you really
218   want to put in the patch e-mail, should come after the
219   three-dash line that signals the end of the commit message.
222 Pine
223 ----
225 (Johannes Schindelin)
227 I don't know how many people still use pine, but for those poor
228 souls it may be good to mention that the quell-flowed-text is
229 needed for recent versions.
231 ... the "no-strip-whitespace-before-send" option, too. AFAIK it
232 was introduced in 4.60.
234 (Linus Torvalds)
236 And 4.58 needs at least this.
239 diff-tree 8326dd8350be64ac7fc805f6563a1d61ad10d32c (from e886a61f76edf5410573e92e38ce22974f9c40f1)
240 Author: Linus Torvalds <torvalds@g5.osdl.org>
241 Date:   Mon Aug 15 17:23:51 2005 -0700
243     Fix pine whitespace-corruption bug
245     There's no excuse for unconditionally removing whitespace from
246     the pico buffers on close.
248 diff --git a/pico/pico.c b/pico/pico.c
249 --- a/pico/pico.c
250 +++ b/pico/pico.c
251 @@ -219,7 +219,9 @@ PICO *pm;
252             switch(pico_all_done){      /* prepare for/handle final events */
253               case COMP_EXIT :          /* already confirmed */
254                 packheader();
255 +#if 0
256                 stripwhitespace();
257 +#endif
258                 c |= COMP_EXIT;
259                 break;
262 (Daniel Barkalow)
264 > A patch to SubmittingPatches, MUA specific help section for
265 > users of Pine 4.63 would be very much appreciated.
267 Ah, it looks like a recent version changed the default behavior to do the
268 right thing, and inverted the sense of the configuration option. (Either
269 that or Gentoo did it.) So you need to set the
270 "no-strip-whitespace-before-send" option, unless the option you have is
271 "strip-whitespace-before-send", in which case you should avoid checking
275 Thunderbird
276 -----------
278 (A Large Angry SCM)
280 Here are some hints on how to successfully submit patches inline using
281 Thunderbird.
283 This recipe appears to work with the current [*1*] Thunderbird from Suse.
285 The following Thunderbird extensions are needed:
286         AboutConfig 0.5
287                 http://aboutconfig.mozdev.org/
288         External Editor 0.7.2
289                 http://globs.org/articles.php?lng=en&pg=8
291 1) Prepare the patch as a text file using your method of choice.
293 2) Before opening a compose window, use Edit->Account Settings to
294 uncheck the "Compose messages in HTML format" setting in the
295 "Composition & Addressing" panel of the account to be used to send the
296 patch. [*2*]
298 3) In the main Thunderbird window, _before_ you open the compose window
299 for the patch, use Tools->about:config to set the following to the
300 indicated values:
301         mailnews.send_plaintext_flowed  => false
302         mailnews.wraplength             => 0
304 4) Open a compose window and click the external editor icon.
306 5) In the external editor window, read in the patch file and exit the
307 editor normally.
309 6) Back in the compose window: Add whatever other text you wish to the
310 message, complete the addressing and subject fields, and press send.
312 7) Optionally, undo the about:config/account settings changes made in
313 steps 2 & 3.
316 [Footnotes]
317 *1* Version 1.0 (20041207) from the MozillaThunderbird-1.0-5 rpm of Suse
318 9.3 professional updates.
320 *2* It may be possible to do this with about:config and the following
321 settings but I haven't tried, yet.
322         mail.html_compose                       => false
323         mail.identity.default.compose_html      => false
324         mail.identity.id?.compose_html          => false
328 Gnus
329 ----
331 '|' in the *Summary* buffer can be used to pipe the current
332 message to an external program, and this is a handy way to drive
333 "git am".  However, if the message is MIME encoded, what is
334 piped into the program is the representation you see in your
335 *Article* buffer after unwrapping MIME.  This is often not what
336 you would want for two reasons.  It tends to screw up non ASCII
337 characters (most notably in people's names), and also
338 whitespaces (fatal in patches).  Running 'C-u g' to display the
339 message in raw form before using '|' to run the pipe can work
340 this problem around.