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