connect: display connection progress
[git/dscho.git] / Documentation / SubmittingPatches
blob6a4da2ddd94093aaa03656303c40a5b20bae2fef
1 Checklist (and a short version for the impatient):
3         Commits:
5         - make commits of logical units
6         - check for unnecessary whitespace with "git diff --check"
7           before committing
8         - do not check in commented out code or unneeded files
9         - provide a meaningful commit message
10         - the first line of the commit message should be a short
11           description and should skip the full stop
12         - if you want your work included in git.git, add a
13           "Signed-off-by: Your Name <your@email.com>" line to the
14           commit message (or just use the option "-s" when
15           committing) to confirm that you agree to the Developer's
16           Certificate of Origin
18         Patch:
20         - use "git format-patch -M" to create the patch
21         - send your patch to <git@vger.kernel.org>. If you use
22           git-send-email(1), please test it first by sending
23           email to yourself.
24         - do not PGP sign your patch
25         - do not attach your patch, but read in the mail
26           body, unless you cannot teach your mailer to
27           leave the formatting of the patch alone.
28         - be careful doing cut & paste into your mailer, not to
29           corrupt whitespaces.
30         - provide additional information (which is unsuitable for
31           the commit message) between the "---" and the diffstat
32         - send the patch to the list _and_ the maintainer
33         - if you change, add, or remove a command line option or
34           make some other user interface change, the associated
35           documentation should be updated as well.
37 Long version:
39 I started reading over the SubmittingPatches document for Linux
40 kernel, primarily because I wanted to have a document similar to
41 it for the core GIT to make sure people understand what they are
42 doing when they write "Signed-off-by" line.
44 But the patch submission requirements are a lot more relaxed
45 here on the technical/contents front, because the core GIT is
46 thousand times smaller ;-).  So here is only the relevant bits.
49 (1) Make separate commits for logically separate changes.
51 Unless your patch is really trivial, you should not be sending
52 out a patch that was generated between your working tree and
53 your commit head.  Instead, always make a commit with complete
54 commit message and generate a series of patches from your
55 repository.  It is a good discipline.
57 Describe the technical detail of the change(s).
59 If your description starts to get too long, that's a sign that you
60 probably need to split up your commit to finer grained pieces.
62 Oh, another thing.  I am picky about whitespaces.  Make sure your
63 changes do not trigger errors with the sample pre-commit hook shipped
64 in templates/hooks--pre-commit.  To help ensure this does not happen,
65 run git diff --check on your changes before you commit.
68 (2) Generate your patch using git tools out of your commits.
70 git based diff tools (git, Cogito, and StGIT included) generate
71 unidiff which is the preferred format.
73 You do not have to be afraid to use -M option to "git diff" or
74 "git format-patch", if your patch involves file renames.  The
75 receiving end can handle them just fine.
77 Please make sure your patch does not include any extra files
78 which do not belong in a patch submission.  Make sure to review
79 your patch after generating it, to ensure accuracy.  Before
80 sending out, please make sure it cleanly applies to the "master"
81 branch head.  If you are preparing a work based on "next" branch,
82 that is fine, but please mark it as such.
85 (3) Sending your patches.
87 People on the git mailing list need to be able to read and
88 comment on the changes you are submitting.  It is important for
89 a developer to be able to "quote" your changes, using standard
90 e-mail tools, so that they may comment on specific portions of
91 your code.  For this reason, all patches should be submitted
92 "inline".  WARNING: Be wary of your MUAs word-wrap
93 corrupting your patch.  Do not cut-n-paste your patch; you can
94 lose tabs that way if you are not careful.
96 It is a common convention to prefix your subject line with
97 [PATCH].  This lets people easily distinguish patches from other
98 e-mail discussions.
100 "git format-patch" command follows the best current practice to
101 format the body of an e-mail message.  At the beginning of the
102 patch should come your commit message, ending with the
103 Signed-off-by: lines, and a line that consists of three dashes,
104 followed by the diffstat information and the patch itself.  If
105 you are forwarding a patch from somebody else, optionally, at
106 the beginning of the e-mail message just before the commit
107 message starts, you can put a "From: " line to name that person.
109 You often want to add additional explanation about the patch,
110 other than the commit message itself.  Place such "cover letter"
111 material between the three dash lines and the diffstat.
113 Do not attach the patch as a MIME attachment, compressed or not.
114 Do not let your e-mail client send quoted-printable.  Do not let
115 your e-mail client send format=flowed which would destroy
116 whitespaces in your patches. Many
117 popular e-mail applications will not always transmit a MIME
118 attachment as plain text, making it impossible to comment on
119 your code.  A MIME attachment also takes a bit more time to
120 process.  This does not decrease the likelihood of your
121 MIME-attached change being accepted, but it makes it more likely
122 that it will be postponed.
124 Exception:  If your mailer is mangling patches then someone may ask
125 you to re-send them using MIME, that is OK.
127 Do not PGP sign your patch, at least for now.  Most likely, your
128 maintainer or other people on the list would not have your PGP
129 key and would not bother obtaining it anyway.  Your patch is not
130 judged by who you are; a good patch from an unknown origin has a
131 far better chance of being accepted than a patch from a known,
132 respected origin that is done poorly or does incorrect things.
134 If you really really really really want to do a PGP signed
135 patch, format it as "multipart/signed", not a text/plain message
136 that starts with '-----BEGIN PGP SIGNED MESSAGE-----'.  That is
137 not a text/plain, it's something else.
139 Note that your maintainer does not necessarily read everything
140 on the git mailing list.  If your patch is for discussion first,
141 send it "To:" the mailing list, and optionally "cc:" him.  If it
142 is trivially correct or after the list reached a consensus, send
143 it "To:" the maintainer and optionally "cc:" the list.
145 Also note that your maintainer does not actively involve himself in
146 maintaining what are in contrib/ hierarchy.  When you send fixes and
147 enhancements to them, do not forget to "cc: " the person who primarily
148 worked on that hierarchy in contrib/.
151 (4) Sign your work
153 To improve tracking of who did what, we've borrowed the
154 "sign-off" procedure from the Linux kernel project on patches
155 that are being emailed around.  Although core GIT is a lot
156 smaller project it is a good discipline to follow it.
158 The sign-off is a simple line at the end of the explanation for
159 the patch, which certifies that you wrote it or otherwise have
160 the right to pass it on as a open-source patch.  The rules are
161 pretty simple: if you can certify the below:
163         Developer's Certificate of Origin 1.1
165         By making a contribution to this project, I certify that:
167         (a) The contribution was created in whole or in part by me and I
168             have the right to submit it under the open source license
169             indicated in the file; or
171         (b) The contribution is based upon previous work that, to the best
172             of my knowledge, is covered under an appropriate open source
173             license and I have the right under that license to submit that
174             work with modifications, whether created in whole or in part
175             by me, under the same open source license (unless I am
176             permitted to submit under a different license), as indicated
177             in the file; or
179         (c) The contribution was provided directly to me by some other
180             person who certified (a), (b) or (c) and I have not modified
181             it.
183         (d) I understand and agree that this project and the contribution
184             are public and that a record of the contribution (including all
185             personal information I submit with it, including my sign-off) is
186             maintained 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 for
197 now, but you can do this to mark internal company procedures or just
198 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   git.git public repository:
226     $ git fetch http://kernel.org/pub/scm/git/git.git master:test-apply
227     $ git checkout test-apply
228     $ git reset --hard
229     $ git applymbox 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
357 Gnus
358 ----
360 '|' in the *Summary* buffer can be used to pipe the current
361 message to an external program, and this is a handy way to drive
362 "git am".  However, if the message is MIME encoded, what is
363 piped into the program is the representation you see in your
364 *Article* buffer after unwrapping MIME.  This is often not what
365 you would want for two reasons.  It tends to screw up non ASCII
366 characters (most notably in people's names), and also
367 whitespaces (fatal in patches).  Running 'C-u g' to display the
368 message in raw form before using '|' to run the pipe can work
369 this problem around.
372 KMail
373 -----
375 This should help you to submit patches inline using KMail.
377 1) Prepare the patch as a text file.
379 2) Click on New Mail.
381 3) Go under "Options" in the Composer window and be sure that
382 "Word wrap" is not set.
384 4) Use Message -> Insert file... and insert the patch.
386 5) Back in the compose window: add whatever other text you wish to the
387 message, complete the addressing and subject fields, and press send.