Skip to content

Commit def8c6a

Browse files
committed
Merge branch 'jc/doc-submitting-patches-choice-of-base'
Extend the guidance to choose the base commit to build your work on, and hint/nudge contributors to read others' changes. * jc/doc-submitting-patches-choice-of-base: SubmittingPatchs: clarify choice of base and testing
2 parents 9b6eda0 + fdfae83 commit def8c6a

File tree

1 file changed

+39
-14
lines changed

1 file changed

+39
-14
lines changed

Documentation/SubmittingPatches

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,21 @@ change is relevant to.
1919
base your work on the tip of the topic.
2020

2121
* A new feature should be based on `master` in general. If the new
22-
feature depends on a topic that is in `seen`, but not in `master`,
23-
base your work on the tip of that topic.
22+
feature depends on other topics that are in `next`, but not in
23+
`master`, fork a branch from the tip of `master`, merge these topics
24+
to the branch, and work on that branch. You can remind yourself of
25+
how you prepared the base with `git log --first-parent master..`.
2426

2527
* Corrections and enhancements to a topic not yet in `master` should
2628
be based on the tip of that topic. If the topic has not been merged
2729
to `next`, it's alright to add a note to squash minor corrections
2830
into the series.
2931

3032
* In the exceptional case that a new feature depends on several topics
31-
not in `master`, start working on `next` or `seen` privately and send
32-
out patches for discussion. Before the final merge, you may have to
33-
wait until some of the dependent topics graduate to `master`, and
34-
rebase your work.
33+
not in `master`, start working on `next` or `seen` privately and
34+
send out patches only for discussion. Once your new feature starts
35+
to stabilize, you would have to rebase it (see the "depends on other
36+
topics" above).
3537

3638
* Some parts of the system have dedicated maintainers with their own
3739
repositories (see the section "Subsystems" below). Changes to
@@ -71,8 +73,13 @@ Make sure that you have tests for the bug you are fixing. See
7173
[[tests]]
7274
When adding a new feature, make sure that you have new tests to show
7375
the feature triggers the new behavior when it should, and to show the
74-
feature does not trigger when it shouldn't. After any code change, make
75-
sure that the entire test suite passes.
76+
feature does not trigger when it shouldn't. After any code change,
77+
make sure that the entire test suite passes. When fixing a bug, make
78+
sure you have new tests that break if somebody else breaks what you
79+
fixed by accident to avoid regression. Also, try merging your work to
80+
'next' and 'seen' and make sure the tests still pass; topics by others
81+
that are still in flight may have unexpected interactions with what
82+
you are trying to do in your topic.
7683

7784
Pushing to a fork of https://github.com/git/git will use their CI
7885
integration to test your changes on Linux, Mac and Windows. See the
@@ -144,8 +151,21 @@ without external resources. Instead of giving a URL to a mailing list
144151
archive, summarize the relevant points of the discussion.
145152

146153
[[commit-reference]]
147-
If you want to reference a previous commit in the history of a stable
148-
branch, use the format "abbreviated hash (subject, date)", like this:
154+
155+
There are a few reasons why you may want to refer to another commit in
156+
the "more stable" part of the history (i.e. on branches like `maint`,
157+
`master`, and `next`):
158+
159+
. A commit that introduced the root cause of a bug you are fixing.
160+
161+
. A commit that introduced a feature that you are enhancing.
162+
163+
. A commit that conflicts with your work when you made a trial merge
164+
of your work into `next` and `seen` for testing.
165+
166+
When you reference a commit on a more stable branch (like `master`,
167+
`maint` and `next`), use the format "abbreviated hash (subject,
168+
date)", like this:
149169

150170
....
151171
Commit f86a374 (pack-bitmap.c: fix a memleak, 2015-03-30)
@@ -259,9 +279,11 @@ Please make sure your patch does not add commented out debugging code,
259279
or include any extra files which do not relate to what your patch
260280
is trying to achieve. Make sure to review
261281
your patch after generating it, to ensure accuracy. Before
262-
sending out, please make sure it cleanly applies to the `master`
263-
branch head. If you are preparing a work based on "next" branch,
264-
that is fine, but please mark it as such.
282+
sending out, please make sure it cleanly applies to the base you
283+
have chosen in the "Decide what to base your work on" section,
284+
and unless it targets the `master` branch (which is the default),
285+
mark your patches as such.
286+
265287

266288
[[send-patches]]
267289
=== Sending your patches.
@@ -365,7 +387,10 @@ Security mailing list{security-ml-ref}.
365387
Send your patch with "To:" set to the mailing list, with "cc:" listing
366388
people who are involved in the area you are touching (the `git
367389
contacts` command in `contrib/contacts/` can help to
368-
identify them), to solicit comments and reviews.
390+
identify them), to solicit comments and reviews. Also, when you made
391+
trial merges of your topic to `next` and `seen`, you may have noticed
392+
work by others conflicting with your changes. There is a good possibility
393+
that these people may know the area you are touching well.
369394

370395
:current-maintainer: footnote:[The current maintainer: [email protected]]
371396
:git-ml: footnote:[The mailing list: [email protected]]

0 commit comments

Comments
 (0)