aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/SubmittingPatches
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2014-12-23 10:43:41 -0500
committerJonathan Corbet <corbet@lwn.net>2014-12-23 10:43:41 -0500
commit7994cc15d83c6188a77516f4c8400d3a4965b0a5 (patch)
tree03cdbf355e8ce1ff2267cafa953f238c7ed53017 /Documentation/SubmittingPatches
parent6de16eba62b3b4d01b2b232ea7724d5450a19e30 (diff)
Docs: Bring SubmittingPatches more into the git era
Much of the information in SubmittingPatches shows its pre-git history. Clean that up a bit and rephrase things with the assumption that developers will be using git. Also rewrite the "pull requests" section and include information on using signed tags. Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'Documentation/SubmittingPatches')
-rw-r--r--Documentation/SubmittingPatches116
1 files changed, 87 insertions, 29 deletions
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
index 8f416a2b409f..230a3b892db6 100644
--- a/Documentation/SubmittingPatches
+++ b/Documentation/SubmittingPatches
@@ -24,13 +24,30 @@ SECTION 1 - CREATING AND SENDING YOUR CHANGE
24-------------------------------------------- 24--------------------------------------------
25 25
26 26
270) Obtain a current source tree
28-------------------------------
29
30If you do not have a repository with the current kernel source handy, use
31git to obtain one. You'll want to start with the mainline repository,
32which can be grabbed with:
33
34 git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
35
36Note, however, that you may not want to develop against the mainline tree
37directly. Most subsystem maintainers run their own trees and want to see
38patches prepared against those trees. See the "T:" entry for the subsystem
39in the MAINTAINERS file to find that tree, or simply ask the maintainer if
40the tree is not listed there.
41
42It is still possible to download kernel releases via tarballs (as described
43in the next section), but that is the hard way to do kernel development.
27 44
281) "diff -up" 451) "diff -up"
29------------ 46------------
30 47
31Use "diff -up" or "diff -uprN" to create patches. git generates patches 48If you must generate your patches by hand, use "diff -up" or "diff -uprN"
32in this form by default; if you're using git, you can skip this section 49to create patches. Git generates patches in this form by default; if
33entirely. 50you're using git, you can skip this section entirely.
34 51
35All changes to the Linux kernel occur in the form of patches, as 52All changes to the Linux kernel occur in the form of patches, as
36generated by diff(1). When creating your patch, make sure to create it 53generated by diff(1). When creating your patch, make sure to create it
@@ -156,10 +173,15 @@ Example:
156 platform_set_drvdata(), but left the variable "dev" unused, 173 platform_set_drvdata(), but left the variable "dev" unused,
157 delete it. 174 delete it.
158 175
176You should also be sure to use at least the first twelve characters of the
177SHA-1 ID. The kernel repository holds a *lot* of objects, making
178collisions with shorter IDs a real possibility. Bear in mind that, even if
179there is no collision with your six-character ID now, that condition may
180change five years from now.
181
159If your patch fixes a bug in a specific commit, e.g. you found an issue using 182If your patch fixes a bug in a specific commit, e.g. you found an issue using
160git-bisect, please use the 'Fixes:' tag with the first 12 characters of the 183git-bisect, please use the 'Fixes:' tag with the first 12 characters of the
161SHA-1 ID, and the one line summary. 184SHA-1 ID, and the one line summary. For example:
162Example:
163 185
164 Fixes: e21d2170f366 ("video: remove unnecessary platform_set_drvdata()") 186 Fixes: e21d2170f366 ("video: remove unnecessary platform_set_drvdata()")
165 187
@@ -188,6 +210,12 @@ If one patch depends on another patch in order for a change to be
188complete, that is OK. Simply note "this patch depends on patch X" 210complete, that is OK. Simply note "this patch depends on patch X"
189in your patch description. 211in your patch description.
190 212
213When dividing your change into a series of patches, take special care to
214ensure that the kernel builds and runs properly after each patch in the
215series. Developers using "git bisect" to track down a problem can end up
216splitting your patch series at any point; they will not thank you if you
217introduce bugs in the middle.
218
191If you cannot condense your patch set into a smaller set of patches, 219If you cannot condense your patch set into a smaller set of patches,
192then only post say 15 or so at a time and wait for review and integration. 220then only post say 15 or so at a time and wait for review and integration.
193 221
@@ -445,15 +473,15 @@ which appears in the changelog.
445Special note to back-porters: It seems to be a common and useful practice 473Special note to back-porters: It seems to be a common and useful practice
446to insert an indication of the origin of a patch at the top of the commit 474to insert an indication of the origin of a patch at the top of the commit
447message (just after the subject line) to facilitate tracking. For instance, 475message (just after the subject line) to facilitate tracking. For instance,
448here's what we see in 2.6-stable : 476here's what we see in a 3.x-stable release:
449 477
450 Date: Tue May 13 19:10:30 2008 +0000 478Date: Tue Oct 7 07:26:38 2014 -0400
451 479
452 SCSI: libiscsi regression in 2.6.25: fix nop timer handling 480 libata: Un-break ATA blacklist
453 481
454 commit 4cf1043593db6a337f10e006c23c69e5fc93e722 upstream 482 commit 1c40279960bcd7d52dbdf1d466b20d24b99176c8 upstream.
455 483
456And here's what appears in 2.4 : 484And here's what might appear in an older kernel once a patch is backported:
457 485
458 Date: Tue May 13 22:12:27 2008 +0200 486 Date: Tue May 13 22:12:27 2008 +0200
459 487
@@ -462,7 +490,7 @@ And here's what appears in 2.4 :
462 [backport of 2.6 commit b7acbdfbd1f277c1eb23f344f899cfa4cd0bf36a] 490 [backport of 2.6 commit b7acbdfbd1f277c1eb23f344f899cfa4cd0bf36a]
463 491
464Whatever the format, this information provides a valuable help to people 492Whatever the format, this information provides a valuable help to people
465tracking your trees, and to people trying to trouble-shoot bugs in your 493tracking your trees, and to people trying to troubleshoot bugs in your
466tree. 494tree.
467 495
468 496
@@ -558,6 +586,12 @@ method for indicating a bug fixed by the patch. See #2 above for more details.
558 586
559 587
56015) The canonical patch format 58815) The canonical patch format
589------------------------------
590
591This section describes how the patch itself should be formatted. Note
592that, if you have your patches stored in a git repository, proper patch
593formatting can be had with "git format-patch". The tools cannot create
594the necessary text, though, so read the instructions below anyway.
561 595
562The canonical patch subject line is: 596The canonical patch subject line is:
563 597
@@ -672,33 +706,57 @@ See more details on the proper patch format in the following
672references. 706references.
673 707
674 708
67516) Sending "git pull" requests (from Linus emails) 70916) Sending "git pull" requests
710-------------------------------
711
712If you have a series of patches, it may be most convenient to have the
713maintainer pull them directly into the subsystem repository with a
714"git pull" operation. Note, however, that pulling patches from a developer
715requires a higher degree of trust than taking patches from a mailing list.
716As a result, many subsystem maintainers are reluctant to take pull
717requests, especially from new, unknown developers.
718
719A pull request should have [GIT] or [PULL] in the subject line. The
720request itself should include the repository name and the branch of
721interest on a single line; it should look something like:
722
723 Please pull from
676 724
677Please write the git repo address and branch name alone on the same line 725 git://jdelvare.pck.nerim.net/jdelvare-2.6 i2c-for-linus
678so that I can't even by mistake pull from the wrong branch, and so
679that a triple-click just selects the whole thing.
680 726
681So the proper format is something along the lines of: 727 to get these changes:"
682 728
683 "Please pull from 729A pull request should also include an overall message saying what will be
730included in the request, a "git shortlog" listing of the patches
731themselves, and a diffstat showing the overall effect of the patch series.
732The easiest way to get all this information together is, of course, to let
733git do it for you with the "git request-pull" command.
684 734
685 git://jdelvare.pck.nerim.net/jdelvare-2.6 i2c-for-linus 735Some maintainers (including Linus) want to see pull requests from signed
736commits; that increases their confidence that the request actually came
737from you. Linus, in particular, will not pull from public hosting sites
738like GitHub in the absence of a signed tag.
686 739
687 to get these changes:" 740The first step toward creating such tags is to make a GNUPG key and get it
741signed by one or more core kernel developers. This step can be hard for
742new developers, but there is no way around it. Attending conferences can
743be a good way to find developers who can sign your key.
688 744
689so that I don't have to hunt-and-peck for the address and inevitably 745Once you have prepared a patch series in git that you wish to have somebody
690get it wrong (actually, I've only gotten it wrong a few times, and 746pull, create a signed tag with "git tag -s". This will create a new tag
691checking against the diffstat tells me when I get it wrong, but I'm 747identifying the last commit in the series and containing a signature
692just a lot more comfortable when I don't have to "look for" the right 748created with your private key. You will also have the opportunity to add a
693thing to pull, and double-check that I have the right branch-name). 749changelog-style message to the tag; this is an ideal place to describe the
750effects of the pull request as a whole.
694 751
752If the tree the maintainer will be pulling from is not the repository you
753are working from, don't forget to push the signed tag explicitly to the
754public tree.
695 755
696Please use "git diff -M --stat --summary" to generate the diffstat: 756When generating your pull request, use the signed tag as the target. A
697the -M enables rename detection, and the summary enables a summary of 757command like this will do the trick:
698new/deleted or renamed files.
699 758
700With rename detection, the statistics are rather different [...] 759 git request-pull master git://my.public.tree/linux.git my-signed-tag
701because git will notice that a fair number of the changes are renames.
702 760
703 761
704---------------------- 762----------------------