Documentation / SubmittingPatcheson commit [PATCH] Add some documentation. (f58b743)
   1I started reading over the SubmittingPatches document for Linux
   2kernel, primarily because I wanted to have a document similar to
   3it for the core GIT to make sure people understand what they are
   4doing when they write "Signed-off-by" line.
   5
   6But the patch submission requirements are a lot more relaxed
   7here, because the core GIT is thousand times smaller ;-).  So
   8here is only the relevant bits.
   9
  10
  11(1) Make separate commits for logically separate changes.
  12
  13Unless your patch is really trivial, you should not be sending
  14out a patch that was generated between your working tree and
  15your commit head.  Instead, always make a commit with complete
  16commit message and generate a series of patches from your
  17repository.  It is a good discipline.
  18
  19Describe the technical detail of the change(s).
  20
  21If your description starts to get long, that's a sign that you
  22probably need to split up your commit to finer grained pieces.
  23
  24
  25(2) Generate your patch using git/cogito out of your commits.
  26
  27git diff tools generate unidiff which is the preferred format.
  28You do not have to be afraid to use -M option to "git diff" or
  29"git format-patch", if your patch involves file renames.  The
  30receiving end can handle them just fine.
  31
  32Please make sure your patch does not include any extra files
  33which do not belong in a patch submission.  Make sure to review
  34your patch after generating it, to ensure accuracy.  Before
  35sending out, please make sure it cleanly applies to the "master"
  36branch head.
  37
  38
  39(3) Sending your patches.
  40
  41People on the git mailing list needs to be able to read and
  42comment on the changes you are submitting.  It is important for
  43a developer to be able to "quote" your changes, using standard
  44e-mail tools, so that they may comment on specific portions of
  45your code.  For this reason, all patches should be submitting
  46e-mail "inline".  WARNING: Be wary of your MUAs word-wrap
  47corrupting your patch.  Do not cut-n-paste your patch.
  48
  49It is common convention to prefix your subject line with
  50[PATCH].  This lets people easily distinguish patches from other
  51e-mail discussions.
  52
  53"git format-patch" command follows the best current practice to
  54format the body of an e-mail message.  At the beginning of the
  55patch should come your commit message, ending with the
  56Signed-off-by: lines, and a line that consists of three dashes,
  57followed by the diffstat information and the patch itself.  If
  58you are forwarding a patch from somebody else, optionally, at
  59the beginning of the e-mail message just before the commit
  60message starts, you can put a "From: " line to name that person.
  61
  62You often want to add additional explanation about the patch,
  63other than the commit message itself.  Place such "cover letter"
  64material between the three dash lines and the diffstat.
  65
  66Do not attach the patch as a MIME attachment, compressed or not.
  67Do not let your e-mail client send quoted-printable.  Many
  68popular e-mail applications will not always transmit a MIME
  69attachment as plain text, making it impossible to comment on
  70your code.  A MIME attachment also takes a bit more time to
  71process.  This does not decrease the likelihood of your
  72MIME-attached change being accepted, but it makes it more likely
  73that it will be postponed.
  74
  75Exception:  If your mailer is mangling patches then someone may ask
  76you to re-send them using MIME.
  77
  78Note that your maintainer does not subscribe to the git mailing
  79list (he reads it via mail-to-news gateway).  If your patch is
  80for discussion first, send it "To:" the mailing list, and
  81optoinally "cc:" him.  If it is trivially correct or after list
  82discussion reached consensus, send it "To:" the maintainer and
  83optionally "cc:" the list.
  84
  85
  86(6) Sign your work
  87
  88To improve tracking of who did what, we've borrowed the
  89"sign-off" procedure from the Linux kernel project on patches
  90that are being emailed around.  Although core GIT is a lot
  91smaller project it is a good discipline to follow it.
  92
  93The sign-off is a simple line at the end of the explanation for
  94the patch, which certifies that you wrote it or otherwise have
  95the right to pass it on as a open-source patch.  The rules are
  96pretty simple: if you can certify the below:
  97
  98        Developer's Certificate of Origin 1.1
  99
 100        By making a contribution to this project, I certify that:
 101
 102        (a) The contribution was created in whole or in part by me and I
 103            have the right to submit it under the open source license
 104            indicated in the file; or
 105
 106        (b) The contribution is based upon previous work that, to the best
 107            of my knowledge, is covered under an appropriate open source
 108            license and I have the right under that license to submit that
 109            work with modifications, whether created in whole or in part
 110            by me, under the same open source license (unless I am
 111            permitted to submit under a different license), as indicated
 112            in the file; or
 113
 114        (c) The contribution was provided directly to me by some other
 115            person who certified (a), (b) or (c) and I have not modified
 116            it.
 117
 118        (d) I understand and agree that this project and the contribution
 119            are public and that a record of the contribution (including all
 120            personal information I submit with it, including my sign-off) is
 121            maintained indefinitely and may be redistributed consistent with
 122            this project or the open source license(s) involved.
 123
 124then you just add a line saying
 125
 126        Signed-off-by: Random J Developer <random@developer.example.org>
 127
 128Some people also put extra tags at the end.  They'll just be ignored for
 129now, but you can do this to mark internal company procedures or just
 130point out some special detail about the sign-off.
 131
 132
 133------------------------------------------------
 134MUA specific hints
 135
 136Some of patches I receive or pick up from the list share common
 137patterns of breakage.  Please make sure your MUA is set up
 138properly not to corrupt whitespaces.  Here are two common ones
 139I have seen:
 140
 141* Empty context lines that do not have _any_ whitespace.
 142
 143* Non empty context lines that have one extra whitespace at the
 144  beginning.
 145
 146
 147Pine
 148----
 149
 150(Johannes Schindelin)
 151
 152I don't know how many people still use pine, but for those poor
 153souls it may be good to mention that the quell-flowed-text is
 154needed for recent versions.
 155
 156... the "no-strip-whitespace-before-send" option, too. AFAIK it
 157was introduced in 4.60.
 158
 159(Linus Torvalds)
 160
 161And 4.58 needs at least this.
 162
 163---
 164diff-tree 8326dd8350be64ac7fc805f6563a1d61ad10d32c (from e886a61f76edf5410573e92e38ce22974f9c40f1)
 165Author: Linus Torvalds <torvalds@g5.osdl.org>
 166Date:   Mon Aug 15 17:23:51 2005 -0700
 167
 168    Fix pine whitespace-corruption bug
 169
 170    There's no excuse for unconditionally removing whitespace from
 171    the pico buffers on close.
 172
 173diff --git a/pico/pico.c b/pico/pico.c
 174--- a/pico/pico.c
 175+++ b/pico/pico.c
 176@@ -219,7 +219,9 @@ PICO *pm;
 177            switch(pico_all_done){      /* prepare for/handle final events */
 178              case COMP_EXIT :          /* already confirmed */
 179                packheader();
 180+#if 0
 181                stripwhitespace();
 182+#endif
 183                c |= COMP_EXIT;
 184                break;
 185 
 186
 187
 188Thunderbird
 189-----------
 190
 191(A Large Angry SCM)
 192
 193Here are some hints on how to successfully submit patches inline using
 194Thunderbird.
 195
 196This recipe appears to work with the current [*1*] Thunderbird from Suse.
 197
 198The following Thunderbird extensions are needed:
 199        AboutConfig 0.5
 200                http://aboutconfig.mozdev.org/
 201        External Editor 0.5.4
 202                http://extensionroom.mozdev.org/more-info/exteditor
 203
 2041) Prepare the patch as a text file using your method of choice.
 205
 2062) Before opening a compose window, use Edit->Account Settings to
 207uncheck the "Compose messages in HTML format" setting in the
 208"Composition & Addressing" panel of the account to be used to send the
 209patch. [*2*]
 210
 2113) In the main Thunderbird window, _before_ you open the compose window
 212for the patch, use Tools->about:config to set the following to the
 213indicated values:
 214        mailnews.send_plaintext_flowed  => false
 215        mailnews.wraplength             => 999
 216
 2174) Open a compose window and click the external editor icon.
 218
 2195) In the external editor window, read in the patch file and exit the
 220editor normally.
 221
 2226) Back in the compose window: Add whatever other text you wish to the
 223message, complete the addressing and subject fields, and press send.
 224
 2257) Optionally, undo the about:config/account settings changes made in
 226steps 2 & 3.
 227
 228
 229[Footnotes]
 230*1* Version 1.0 (20041207) from the MozillaThunderbird-1.0-5 rpm of Suse
 2319.3 professional updates.
 232
 233*2* It may be possible to do this with about:config and the following
 234settings but I haven't tried, yet.
 235        mail.html_compose                       => false
 236        mail.identity.default.compose_html      => false
 237        mail.identity.id?.compose_html          => false
 238
 239
 240