1 How to contribute to Empire
6 Basing your contribution on a tarball may work out okay for simple
7 patches, but for anything serious, you will need the "git" version
10 The primary purpose of this document is to help you setting up a
11 proper development environment, and guide you towards good practices.
12 It is not a git tutorial (but read on for some pointers). It is not
13 about how to do the actual hacking; see doc/coding for that.
19 On Fedora-based systems, do "yum install git". On Debian-based ones
20 install the "git-core" package. You can always download from
21 <http://git-scm.com/>.
23 If you're new to git, try the gittutorial(7) manual page, and the Git
24 User's Manual. Both are also available at <http://git-scm.com/>,
25 along with other resources, including the "Pro Git" book.
31 You can get a copy of the Empire source repository with this command:
33 $ git clone git://git.pond.sub.org/~armbru/empserver
35 If that doesn't work because you're behind a restrictive firewall, try
37 $ git clone http://git.pond.sub.org/empserver
39 Cloning downloads the entire repository, including revision control
40 history dating back to 2003. The repository (the part you download,
41 and which resides in empserver/.git) currently weighs in at about
42 25MiB. But once you got it, you can update it to later versions very
43 efficiently; see "Pulling updates".
45 If you prefer working with github, we maintain a mirror at
46 <https://github.com/gefla/empserver>.
52 Use of a separate build directory is recommended, like this:
62 See README in the top level directory for more detailed information on
69 We can only take patches that record authorship. That is important
70 not just to give credit where due, but also from a legal standpoint
71 (see below). Git records authorship automatically, but you must first
72 tell git who you are. That information is best recorded in your
73 ~/.gitconfig file. Edit that file, creating it if needed, and put
74 your name and email address in place of these example values:
78 email = joe.user@example.com
81 Work on a "topic branch"
82 ------------------------
84 Cloning the repository created a "master" branch for you, tracking the
85 origin's master branch. We recommend you use your master branch only
86 for tracking the origin, and make all your changes on separate topic
87 branches, because doing both on the same branch creates problems when
88 you later pull updates from origin.
90 If you don't know how to create a branch, check out section "Managing
91 branches" in gittutorial(7).
94 Committing changes to your local repository
95 -------------------------------------------
97 If you don't know how to commit, check out section "Making changes" in
100 Commit related changes together, unrelated changes separately.
102 Write meaningful commit messages. Start with a single summary line,
103 followed by a blank line and then a more thorough description.
105 The purpose of the commit message is not to explain how the code
106 works; that should be done in the source code itself. It's to explain
107 *why* you made the change, and what is affected by it.
109 The summary line should begin with "keyword: ". The keyword should
110 identify what area of Empire gets changed. Could be a command name, a
111 directory name, or any other succinct term. You may want to peruse
112 commit logs for inspiration.
114 Keep the summary line short, ideally less than 60 characters.
115 Nevertheless, it should make sense on its own, independently of the
116 description. Yes, coming up with a good summary line can be hard.
118 The description may be as long as you wish. Limit line length to 70
119 characters. Don't use TABs.
121 If your commit fixes a bug, point to the commit that introduced the
122 bug, e.g. "broken in commit 3a7d7fa". If the bug is in a released
123 version, add the first release containing it, like "broken in commit
124 14ea670 (v4.3.8)", or "broken in commit 774b590f, v4.3.17". If the
125 bug predates version control, point just to the release. If you can't
126 find out when it was broken, say so.
128 You may want to sign off your commit now by adding a line
130 Signed-off-by: Your Name <your-email-address>"
132 The easiest way to do so is "git commit" option -s (assuming you
133 followed the "Identify yourself" instructions above).
135 Similar Reported-by:, Tested-by:, and Reviewed-by: lines can be added
136 to give credit for reporting, testing, and reviewing. Do not add them
137 without the credited person's permission.
139 More on these tags can be found at
140 <http://gerrit.googlecode.com/svn/documentation/2.0/user-signedoffby.html>.
146 The first step is to prepare patches for e-mail. Remove any stale
147 patches you may have lying around:
151 If you want to submit a single commit, prepare it like this:
153 $ git format-patch -s -1
155 This produces a file 0001-<subject>.patch, where <subject> is derived
156 from the first line of the commit message.
158 If you want to submit a whole topic branch based on master, do:
160 $ git format-patch -ns --cover-letter master
162 This produces 0000-cover-letter.patch 0001-<subject1>.patch
163 0002-<subject2>.patch and so on. Edit 0000-cover-letter.patch so it
164 serves as an introduction to your patch series.
166 Option -s adds your Signed-off-by, if it's not already present. Your
167 Signed-off-by line certifies that you wrote the patch or otherwise
168 have the right to pass it on, as follows:
170 Developer's Certificate of Origin 1.1
172 By making a contribution to this project, I certify that:
174 (a) The contribution was created in whole or in part by me and I
175 have the right to submit it under the open source license
176 indicated in the file; or
178 (b) The contribution is based upon previous work that, to the best
179 of my knowledge, is covered under an appropriate open source
180 license and I have the right under that license to submit that
181 work with modifications, whether created in whole or in part
182 by me, under the same open source license (unless I am
183 permitted to submit under a different license), as indicated
186 (c) The contribution was provided directly to me by some other
187 person who certified (a), (b) or (c) and I have not modified
190 (d) I understand and agree that this project and the contribution
191 are public and that a record of the contribution (including
192 all personal information I submit with it, including my
193 sign-off) is maintained indefinitely and may be redistributed
195 this project or the open source license(s) involved.
197 Each patch needs to be signed off by everyone who contributed to it,
198 with their real names, not pseudonym, or else we can't accept it as a
199 contribution to Empire.
201 The second step is to e-mail the patches. Common e-mail programs
202 notoriously mangle patches. Therefore, use of "git send-email" is
203 strongly recommended:
205 $ git send-email --to wolfpack@wolfpackempire.com *.patch
207 You may use option --cc to copy yourself and/or other persons.
209 Some configuration may be required to make "git send-email" work with
210 your e-mail account. If you use Gmail, check out
211 <http://morefedora.blogspot.de/2009/02/configuring-git-send-email-to-use-gmail.html>.
213 Of course, you can also submit pull requests.
219 First make sure your working tree is clean, i.e. there are no
220 uncommitted changes. You can use "git stash" to save and restore
223 Switch to branch master:
225 $ git checkout master
227 If you mistakenly committed to master, move the commits to a topic
228 branch, then reset your master to match the origin's:
231 $ git reset --hard origin/master
233 Pull updates from origin into your master:
238 Rebasing topic branches
239 -----------------------
241 After pulling updates, you may want to "rebase" topic branches, so
242 they branch off the latest master. The Git User's Manual covers this
243 in section "Keeping a patch series up to date using git rebase".