2004-08-13 07:53:33 -04:00
|
|
|
_ _ ____ _
|
|
|
|
___| | | | _ \| |
|
|
|
|
/ __| | | | |_) | |
|
|
|
|
| (__| |_| | _ <| |___
|
2000-05-22 13:35:35 -04:00
|
|
|
\___|\___/|_| \_\_____|
|
|
|
|
|
2005-10-28 03:22:45 -04:00
|
|
|
When Contributing Source Code
|
2000-05-22 13:35:35 -04:00
|
|
|
|
2005-10-28 03:22:45 -04:00
|
|
|
This document is intended to offer guidelines that can be useful to keep in
|
|
|
|
mind when you decide to contribute to the project. This concerns new features
|
|
|
|
as well as corrections to existing flaws or bugs.
|
2000-07-31 18:42:34 -04:00
|
|
|
|
2007-09-20 10:43:31 -04:00
|
|
|
1. Learning cURL
|
|
|
|
1.1 Join the Community
|
|
|
|
1.2 License
|
|
|
|
1.3 What To Read
|
|
|
|
|
2016-03-14 05:31:00 -04:00
|
|
|
2. Write a good patch
|
|
|
|
2.1 Follow code style
|
|
|
|
2.2 Non-clobbering All Over
|
|
|
|
2.3 Write Separate Patches
|
|
|
|
2.4 Patch Against Recent Sources
|
|
|
|
2.5 Document
|
|
|
|
2.6 Test Cases
|
2007-09-20 10:43:31 -04:00
|
|
|
|
2016-08-09 04:53:42 -04:00
|
|
|
3. Sharing Your Changes
|
|
|
|
3.1 How to get your changes into the main sources
|
|
|
|
3.2 About pull requests
|
|
|
|
3.3 Making quality patches
|
2010-05-10 11:25:49 -04:00
|
|
|
3.5 Write good commit messages
|
2016-08-09 04:53:42 -04:00
|
|
|
3.6 Write Access to git Repository
|
|
|
|
3.7 How To Make a Patch with git
|
|
|
|
3.8 How To Make a Patch without git
|
2007-09-20 10:43:31 -04:00
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
|
|
|
|
1. Learning cURL
|
|
|
|
|
|
|
|
1.1 Join the Community
|
2001-08-29 11:02:46 -04:00
|
|
|
|
2016-02-01 18:24:30 -05:00
|
|
|
Skip over to https://curl.haxx.se/mail/ and join the appropriate mailing
|
2001-08-29 11:02:46 -04:00
|
|
|
list(s). Read up on details before you post questions. Read this file before
|
2002-10-08 03:11:34 -04:00
|
|
|
you start sending patches! We prefer patches and discussions being held on
|
|
|
|
the mailing list(s), not sent to individuals.
|
2001-08-29 11:02:46 -04:00
|
|
|
|
2007-09-20 10:43:31 -04:00
|
|
|
Before posting to one of the curl mailing lists, please read up on the mailing
|
2016-02-01 18:24:30 -05:00
|
|
|
list etiquette: https://curl.haxx.se/mail/etiquette.html
|
2007-09-20 10:43:31 -04:00
|
|
|
|
2007-03-25 04:41:22 -04:00
|
|
|
We also hang out on IRC in #curl on irc.freenode.net
|
|
|
|
|
2015-03-01 17:39:14 -05:00
|
|
|
If you're at all interested in the code side of things, consider clicking
|
|
|
|
'watch' on the curl repo at github to get notified on pull requests and new
|
|
|
|
issues posted there.
|
|
|
|
|
2007-09-20 10:43:31 -04:00
|
|
|
1.2. License
|
2000-07-31 18:42:34 -04:00
|
|
|
|
|
|
|
When contributing with code, you agree to put your changes and new code under
|
2005-10-28 03:22:45 -04:00
|
|
|
the same license curl and libcurl is already using unless stated and agreed
|
|
|
|
otherwise.
|
2001-01-04 07:43:35 -05:00
|
|
|
|
2000-07-31 18:42:34 -04:00
|
|
|
If you add a larger piece of code, you can opt to make that file or set of
|
2001-04-22 11:44:33 -04:00
|
|
|
files to use a different license as long as they don't enforce any changes to
|
2000-11-29 02:48:14 -05:00
|
|
|
the rest of the package and they make sense. Such "separate parts" can not be
|
2005-10-28 03:22:45 -04:00
|
|
|
GPL licensed (as we don't want copyleft to affect users of libcurl) but they
|
|
|
|
must use "GPL compatible" licenses (as we want to allow users to use libcurl
|
|
|
|
properly in GPL licensed environments).
|
|
|
|
|
|
|
|
When changing existing source code, you do not alter the copyright of the
|
|
|
|
original file(s). The copyright will still be owned by the original
|
|
|
|
creator(s) or those who have been assigned copyright by the original
|
|
|
|
author(s).
|
|
|
|
|
|
|
|
By submitting a patch to the curl project, you are assumed to have the right
|
|
|
|
to the code and to be allowed by your employer or whatever to hand over that
|
|
|
|
patch/code to us. We will credit you for your changes as far as possible, to
|
|
|
|
give credit but also to keep a trace back to who made what changes. Please
|
|
|
|
always provide us with your full real name when contributing!
|
2000-05-22 13:35:35 -04:00
|
|
|
|
2007-09-20 10:43:31 -04:00
|
|
|
1.3 What To Read
|
2001-08-29 11:02:46 -04:00
|
|
|
|
2015-03-17 04:09:23 -04:00
|
|
|
Source code, the man pages, the INTERNALS document, TODO, KNOWN_BUGS and the
|
|
|
|
most recent changes in the git log. Just lurking on the curl-library mailing
|
|
|
|
list is gonna give you a lot of insights on what's going on right now. Asking
|
|
|
|
there is a good idea too.
|
2001-08-29 11:02:46 -04:00
|
|
|
|
2016-03-14 05:31:00 -04:00
|
|
|
2. Write a good patch
|
2007-09-20 10:43:31 -04:00
|
|
|
|
2016-03-14 05:31:00 -04:00
|
|
|
2.1 Follow code style
|
2000-05-22 13:35:35 -04:00
|
|
|
|
2016-03-14 05:31:00 -04:00
|
|
|
When writing C code, follow the CODE_STYLE already established in the
|
|
|
|
project. Consistent style makes code easier to read and mistakes less likely
|
2016-08-09 04:53:42 -04:00
|
|
|
to happen. Run 'make checksrc' before you submit anything, to make sure you
|
|
|
|
follow the basic style. That script doesn't verify everything, but if it
|
|
|
|
complains you know you have work to do.
|
2002-10-08 03:11:34 -04:00
|
|
|
|
2016-03-14 05:31:00 -04:00
|
|
|
2.2 Non-clobbering All Over
|
2000-05-22 13:35:35 -04:00
|
|
|
|
2000-07-31 18:42:34 -04:00
|
|
|
When you write new functionality or fix bugs, it is important that you don't
|
|
|
|
fiddle all over the source files and functions. Remember that it is likely
|
|
|
|
that other people have done changes in the same source files as you have and
|
|
|
|
possibly even in the same functions. If you bring completely new
|
2000-05-22 13:35:35 -04:00
|
|
|
functionality, try writing it in a new source file. If you fix bugs, try to
|
|
|
|
fix one bug at a time and send them as separate patches.
|
|
|
|
|
2016-03-14 05:31:00 -04:00
|
|
|
2.3 Write Separate Patches
|
2000-05-22 13:35:35 -04:00
|
|
|
|
|
|
|
It is annoying when you get a huge patch from someone that is said to fix 511
|
|
|
|
odd problems, but discussions and opinions don't agree with 510 of them - or
|
|
|
|
509 of them were already fixed in a different way. Then the patcher needs to
|
|
|
|
extract the single interesting patch from somewhere within the huge pile of
|
|
|
|
source, and that gives a lot of extra work. Preferably, all fixes that
|
|
|
|
correct different problems should be in their own patch with an attached
|
|
|
|
description exactly what they correct so that all patches can be selectively
|
|
|
|
applied by the maintainer or other interested parties.
|
|
|
|
|
2013-08-06 08:12:45 -04:00
|
|
|
Also, separate patches enable bisecting much better when we track problems in
|
|
|
|
the future.
|
|
|
|
|
2016-03-14 05:31:00 -04:00
|
|
|
2.4 Patch Against Recent Sources
|
2001-01-04 07:43:35 -05:00
|
|
|
|
|
|
|
Please try to get the latest available sources to make your patches
|
2001-03-12 04:43:43 -05:00
|
|
|
against. It makes the life of the developers so much easier. The very best is
|
2010-03-21 19:34:09 -04:00
|
|
|
if you get the most up-to-date sources from the git repository, but the
|
2001-03-12 04:43:43 -05:00
|
|
|
latest release archive is quite OK as well!
|
2001-01-04 07:43:35 -05:00
|
|
|
|
2016-03-14 05:31:00 -04:00
|
|
|
2.5 Document
|
2000-05-22 13:35:35 -04:00
|
|
|
|
2000-07-31 18:42:34 -04:00
|
|
|
Writing docs is dead boring and one of the big problems with many open source
|
|
|
|
projects. Someone's gotta do it. It makes it a lot easier if you submit a
|
|
|
|
small description of your fix or your new features with every contribution so
|
|
|
|
that it can be swiftly added to the package documentation.
|
2000-05-22 13:35:35 -04:00
|
|
|
|
2002-10-08 03:11:34 -04:00
|
|
|
The documentation is always made in man pages (nroff formatted) or plain
|
|
|
|
ASCII files. All HTML files on the web site and in the release archives are
|
|
|
|
generated from the nroff/ASCII versions.
|
|
|
|
|
2016-03-14 05:31:00 -04:00
|
|
|
2.6 Test Cases
|
2000-11-29 02:48:14 -05:00
|
|
|
|
2001-03-12 04:43:43 -05:00
|
|
|
Since the introduction of the test suite, we can quickly verify that the main
|
|
|
|
features are working as they're supposed to. To maintain this situation and
|
|
|
|
improve it, all new features and functions that are added need to be tested
|
|
|
|
in the test suite. Every feature that is added should get at least one valid
|
2000-11-29 02:48:14 -05:00
|
|
|
test case that verifies that it works as documented. If every submitter also
|
2003-08-18 11:27:26 -04:00
|
|
|
posts a few test cases, it won't end up as a heavy burden on a single person!
|
2002-11-28 09:07:14 -05:00
|
|
|
|
2013-08-06 08:12:45 -04:00
|
|
|
If you don't have test cases or perhaps you have done something that is very
|
|
|
|
hard to write tests for, do explain exactly how you have otherwise tested and
|
|
|
|
verified your changes.
|
|
|
|
|
2016-08-09 04:53:42 -04:00
|
|
|
3. Sharing Your Changes
|
2007-09-20 10:43:31 -04:00
|
|
|
|
2016-08-09 04:53:42 -04:00
|
|
|
3.1 How to get your changes into the main sources
|
2007-09-20 10:43:31 -04:00
|
|
|
|
2016-08-09 04:53:42 -04:00
|
|
|
Ideally you file a pull request on github, but you can also send your plain
|
|
|
|
patch to the curl-library mailing list.
|
2007-09-20 10:43:31 -04:00
|
|
|
|
2016-08-09 04:53:42 -04:00
|
|
|
Either way, your change will be reviewed and discussed there and you will be
|
|
|
|
expected to correct flaws pointed out and update accordingly, or the change
|
|
|
|
risk stalling and eventually just get deleted without action. As a submitter
|
|
|
|
of a change, you are the owner of that change until it has been merged.
|
|
|
|
|
|
|
|
Respond on the list or on github about the change and answer questions and/or
|
|
|
|
fix nits/flaws. This is very important. We will take lack of replies as a
|
|
|
|
sign that you're not very anxious to get your patch accepted and we tend to
|
|
|
|
simply drop such changes.
|
|
|
|
|
|
|
|
3.2 About pull requests
|
|
|
|
|
|
|
|
With github it is easy to send a pull request to the curl project to have
|
|
|
|
changes merged this way instead of mailing patches to the curl-library
|
|
|
|
mailing list. See https://github.com/curl/curl/pulls
|
|
|
|
|
|
|
|
We prefer pull requests as it makes it a proper git commit that is easy to
|
|
|
|
merge and they are easy to track and not that easy to loose in a flood of
|
|
|
|
many emails, like they sometimes do on the mailing lists.
|
|
|
|
|
|
|
|
When you ajust your pull requests after review, consider squashing the
|
|
|
|
commits so that we can review the full updated version more easily.
|
|
|
|
|
|
|
|
3.3 Making quality patches
|
|
|
|
|
|
|
|
Make the patch against as recent sources as possible.
|
|
|
|
|
|
|
|
If you've followed the tips in this document and your patch still hasn't been
|
|
|
|
incorporated or responded to after some weeks, consider resubmitting it to
|
|
|
|
the list or better yet: change it to a pull request.
|
|
|
|
|
|
|
|
3.5 Write good commit messages
|
|
|
|
|
|
|
|
A short guide to how to do fine commit messages in the curl project.
|
|
|
|
|
|
|
|
---- start ----
|
|
|
|
[area]: [short line describing the main effect]
|
|
|
|
|
|
|
|
[separate the above single line from the rest with an empty line]
|
|
|
|
|
|
|
|
[full description, no wider than 72 columns that describe as much as
|
|
|
|
possible as to why this change is made, and possibly what things
|
|
|
|
it fixes and everything else that is related]
|
|
|
|
|
|
|
|
[Bug: link to source of the report or more related discussion]
|
|
|
|
[Reported-by: John Doe - credit the reporter]
|
|
|
|
[whatever-else-by: credit all helpers, finders, doers]
|
|
|
|
---- stop ----
|
|
|
|
|
|
|
|
Don't forget to use commit --author="" if you commit someone else's work,
|
|
|
|
and make sure that you have your own user and email setup correctly in git
|
|
|
|
before you commit
|
|
|
|
|
|
|
|
3.6 Write Access to git Repository
|
|
|
|
|
|
|
|
If you are a very frequent contributor, you may be given push access to the
|
|
|
|
git repository and then you'll be able to push your changes straight into the
|
|
|
|
git repo instead of sending changes as pull requests or by mail as patches.
|
|
|
|
|
|
|
|
Just ask if this is what you'd want. You will be required to have posted
|
|
|
|
several high quality patches first, before you can be granted push access.
|
|
|
|
|
|
|
|
3.7 How To Make a Patch with git
|
2010-03-21 19:34:09 -04:00
|
|
|
|
2010-12-24 20:13:43 -05:00
|
|
|
You need to first checkout the repository:
|
2010-04-12 05:20:00 -04:00
|
|
|
|
2016-02-03 12:34:16 -05:00
|
|
|
git clone https://github.com/curl/curl.git
|
2010-04-12 05:20:00 -04:00
|
|
|
|
|
|
|
You then proceed and edit all the files you like and you commit them to your
|
|
|
|
local repository:
|
|
|
|
|
|
|
|
git commit [file]
|
|
|
|
|
|
|
|
As usual, group your commits so that you commit all changes that at once that
|
2010-05-10 11:25:49 -04:00
|
|
|
constitutes a logical change. See also section "3.5 Write good commit
|
|
|
|
messages".
|
2010-04-12 05:20:00 -04:00
|
|
|
|
|
|
|
Once you have done all your commits and you're happy with what you see, you
|
|
|
|
can make patches out of your changes that are suitable for mailing:
|
|
|
|
|
|
|
|
git format-patch remotes/origin/master
|
|
|
|
|
|
|
|
This creates files in your local directory named NNNN-[name].patch for each
|
|
|
|
commit.
|
|
|
|
|
|
|
|
Now send those patches off to the curl-library list. You can of course opt to
|
2013-02-22 07:06:56 -05:00
|
|
|
do that with the 'git send-email' command.
|
2010-03-21 19:34:09 -04:00
|
|
|
|
2016-08-09 04:53:42 -04:00
|
|
|
3.8 How To Make a Patch without git
|
2002-11-28 09:07:14 -05:00
|
|
|
|
|
|
|
Keep a copy of the unmodified curl sources. Make your changes in a separate
|
|
|
|
source tree. When you think you have something that you want to offer the
|
|
|
|
curl community, use GNU diff to generate patches.
|
|
|
|
|
|
|
|
If you have modified a single file, try something like:
|
|
|
|
|
2004-08-13 07:53:33 -04:00
|
|
|
diff -u unmodified-file.c my-changed-one.c > my-fixes.diff
|
2002-11-28 09:07:14 -05:00
|
|
|
|
|
|
|
If you have modified several files, possibly in different directories, you
|
|
|
|
can use diff recursively:
|
|
|
|
|
2004-08-13 07:53:33 -04:00
|
|
|
diff -ur curl-original-dir curl-modified-sources-dir > my-fixes.diff
|
2002-11-28 09:07:14 -05:00
|
|
|
|
2003-03-26 06:48:03 -05:00
|
|
|
The GNU diff and GNU patch tools exist for virtually all platforms, including
|
2004-08-13 07:53:33 -04:00
|
|
|
all kinds of Unixes and Windows:
|
2003-03-26 06:48:03 -05:00
|
|
|
|
|
|
|
For unix-like operating systems:
|
|
|
|
|
2015-06-15 18:47:26 -04:00
|
|
|
https://savannah.gnu.org/projects/patch/
|
|
|
|
https://www.gnu.org/software/diffutils/
|
2003-03-26 06:48:03 -05:00
|
|
|
|
|
|
|
For Windows:
|
|
|
|
|
2011-03-18 06:14:51 -04:00
|
|
|
http://gnuwin32.sourceforge.net/packages/patch.htm
|
|
|
|
http://gnuwin32.sourceforge.net/packages/diffutils.htm
|