Window Maker 0.95.6
[wmaker-crm.git] / The-perfect-Window-Maker-patch.txt
Commit [+]AuthorDateLineData
781b6633
CM
Carlos R. Mafra2009-10-11 17:14:53 +02001____________
2Introduction
3------------
4
8b049dec
CM
Carlos R. Mafra2012-01-14 15:11:21 +00005These notes are meant to help you in the process of making and submitting
6patches to the git repository of wmaker-crm.
781b6633 Carlos R. Mafra2009-10-11 17:14:53 +02007
8b049dec
CM
Carlos R. Mafra2012-01-14 15:11:21 +00008It assumes you have 'git' correctly installed and you have set the most
9basic configuration options via 'git config'. See the end of this file
10for an example .gitconfig.
781b6633 Carlos R. Mafra2009-10-11 17:14:53 +020011
8b049dec Carlos R. Mafra2012-01-14 15:11:21 +000012To clone the wmaker-crm repository you can do:
781b6633 Carlos R. Mafra2009-10-11 17:14:53 +020013
781b6633
CM
Carlos R. Mafra2009-10-11 17:14:53 +020014git clone git://repo.or.cz/wmaker-crm.git
15
fd5c06c0
CC
Christophe CURIS2014-03-02 00:44:15 +010016You should note that the development occur in the #next branch, and
17patches are backported to #master when considered ok. So, you probably
18want to switch to #next branch, if not already done:
19
20git checkout next
21
029846dd
CC
Christophe CURIS2014-07-04 23:28:49 +020022____________________
23Testing your changes
24--------------------
25
26If you want to raise the quality of your contribution, you are strongly
27encouraged to use at least this configure option:
28
29./configure --enable-debug
30
31This does not only enable debugging information, which you may need when
32testing your work, it also enables a number of extra compiler warning
33which help keeping safer code.
34
8b049dec
CM
Carlos R. Mafra2012-01-14 15:11:21 +000035__________________________
36Producing a patch with git
37--------------------------
781b6633 Carlos R. Mafra2009-10-11 17:14:53 +020038
8b049dec Carlos R. Mafra2012-01-14 15:11:21 +000039You have the wmaker source and you want to write a patch in order to fix
0e99f6ea Christophe CURIS2014-03-02 00:44:17 +010040a bug or improve something. A possible work-flow is the following:
781b6633 Carlos R. Mafra2009-10-11 17:14:53 +020041
8b049dec
CM
Carlos R. Mafra2012-01-14 15:11:21 +000042# Optional: Create a new branch (to be safe in case you screw up)
43git checkout -b fixbug
781b6633 Carlos R. Mafra2009-10-11 17:14:53 +020044
8b049dec Carlos R. Mafra2012-01-14 15:11:21 +000045Now you fix the bug...
781b6633 Carlos R. Mafra2009-10-11 17:14:53 +020046
8b049dec Carlos R. Mafra2012-01-14 15:11:21 +000047# Check what you did, review etc
781b6633
CM
Carlos R. Mafra2009-10-11 17:14:53 +020048git diff
49
50# if it looks good, commit your changes
51git commit -a
52
8b049dec
CM
Carlos R. Mafra2012-01-14 15:11:21 +000053Git will open the editor set in your .gitconfig and you'll have to write a
54commit message. Writing a good message is as important as the source code
55modifications you've just made! See "Writing the commit log" for advice.
781b6633 Carlos R. Mafra2009-10-11 17:14:53 +020056
8b049dec Carlos R. Mafra2012-01-14 15:11:21 +000057# Prepare the patch to submit to the mailing-list.
781b6633
CM
Carlos R. Mafra2009-10-11 17:14:53 +020058# (use HEAD~2 if you want patches for the last 2 commits etc)
59git format-patch HEAD~1
60
fd5c06c0
CC
Christophe CURIS2014-03-02 00:44:15 +010061# If you have created your own branch, and want all your commits created
62# after the #next branch, you can use:
63git format-patch next
64
029846dd
CC
Christophe CURIS2014-07-04 23:28:49 +020065
66In order to ensure consistency in the code, there's an extra step to
67check the patchs. You should run this script (inherited from the Linux
68kernel) on the patch files generated and fix your commits for what it
69reports:
70
71./checkpatch.pl 00*
72
8b049dec
CM
Carlos R. Mafra2012-01-14 15:11:21 +000073______________________
74Writing the commit log
75----------------------
76
77You had a motivation to write your patch, you studied the sources and you
78found a way to do what you wanted to do. This whole process takes time and
79other people will not want to invest that time to rediscover what you've
80already found.
81
82So the main reason for the commit message is to explain to other people what
83you did, _why_ and _how_. And you must assume that the person you must explain
84these things to will not be as familiar with the code you just modified as you
85are right after writing the patch -- and that includes yourself in a year or
86so. Be verbose in all the steps below.
87
88The good commit log will start with the reason for writing the patch.
89
90For example, if you use wmaker in some way and you expect that X happens but
91you get Y, you should say that very clearly. Sometimes that's enough for other
92more experienced people to know how to solve your issue. They will be able to
93judge your patch better if they know what you wanted to do -- sometimes there
94can be a better way to fix it.
95
96Then you should explain why the wmaker source leads to Y and not to X.
97
0e99f6ea Christophe CURIS2014-03-02 00:44:17 +010098Technical stuff can be expected at this point, e.g. "upon doing xyz in function
8b049dec
CM
Carlos R. Mafra2012-01-14 15:11:21 +000099foobar(), wmaker sets the variable foo to 'y' instead of setting it to 'x', and
100that will lead to blabla happening in function foobar_squared()...".
101
102And finally you explain how you fixed it.
103
104"You have to set foo to 'x', because then when the function foobar_squared() is
105called it will do X instead of Y because..."
106
107At this point other people will have a clear understanding of what you did with
108minimal effort. And that leads to better patch reviews.
109
110Furthermore, the above reasons should also tell you that you must not do
111more than one thing in the same patch. Again:
112
113 "Each patch must do one thing and one thing only."
114
115If your patch does too much of unrelated stuff, it makes reviewing a nightmare
0e99f6ea Christophe CURIS2014-03-02 00:44:17 +0100116and long-term maintenance much worse (think about a patch which introduces a
8b049dec
CM
Carlos R. Mafra2012-01-14 15:11:21 +0000117regression in the middle of many other nice improvements, and now you have to
118get rid of the regression without removing the improvements -- 'git revert'
119will not help you here).
120
121If you find yourself having troubles to write what you did in the commit
122message, perhaps you did too much. In this case you should split your patch
123into smaller unrelated pieces and produce a patch series. Unfortunately it's
124more work for you, but it's much better for wmaker.
125
126_____________________________________
127Sending the patch to the mailing list
128-------------------------------------
129
130Send your patches to:
131
132wmaker-dev@lists.windowmaker.org
133
134Please do not send patches to any individual developer unless you have a very
135good reason to avoid more people being able to comment (and improve) on your
136patches.
137
fd5c06c0
CC
Christophe CURIS2014-03-02 00:44:15 +0100138The HIGHLY RECOMMENDED way to send a patch is to actually let Git do it for
139you, otherwise you may face the problems below. Doing this is really easy:
140
141# Tell git once how to send mails:
142# (of course, replace smtp.example.com with your ISP's)
143git config --global sendemail.smtpserver "smtp.example.com"
144git config --global sendemail.validate true
145git config sendemail.to "Window Maker Devel <wmaker-dev@lists.windowmaker.org>"
146
147# If you're sending more than 1 patch, you may be interested in having an
148# introduction mail for the batch:
149git format-patch --cover-letter next
150vi/emacs/nedit/whatever 0000-cover-letter.patch
151
152# When you're satisfied, ask Git to mail all the patches:
153git send-email 00*
154
155
156If you do not want or cannot let Git send them for you, please note that
157sending the patch _properly_ is not as trivial as you may think. Some mail
8b049dec
CM
Carlos R. Mafra2012-01-14 15:11:21 +0000158clients convert TABs to spaces or word wrap long lines automatically, which
159will result in your patch being rejected as it will not apply with 'git apply'.
160
fd5c06c0
CC
Christophe CURIS2014-03-02 00:44:15 +0100161You could send the patch as an attachement to the mail, but this generally
162makes it a bit harder to review, and a lot harder to comment on; that's why
163the preferred method is inlined patches (like Git does).
164
8b049dec
CM
Carlos R. Mafra2012-01-14 15:11:21 +0000165Ideally your patch should contain a very good commit message that explains
166why you wrote the patch in the first place (see "Writing the commit log").
167In this case you can simply send the file(s) created in the 'git format-patch'
168step above as the sole content of your email to the mailing list. All your
169reasons and explanations will be in the commit log, and your email will look
170like:
171
172**********************************
173From: someone@someplace
174Subject: [PATCH] Fix something
175
176The commit message.
6c2a5f19 Christophe CURIS2011-07-17 12:20:13 +0200177
8b049dec Carlos R. Mafra2012-01-14 15:11:21 +0000178The diff itself.
781b6633 Carlos R. Mafra2009-10-11 17:14:53 +0200179
8b049dec Carlos R. Mafra2012-01-14 15:11:21 +0000180**********************************
781b6633 Carlos R. Mafra2009-10-11 17:14:53 +0200181
8b049dec Carlos R. Mafra2012-01-14 15:11:21 +0000182Read the file email-clients.txt in the topdir of the wmaker-crm repository
0e99f6ea Christophe CURIS2014-03-02 00:44:17 +0100183to be advised on how to tweak your email client to avoid common pitfalls.
781b6633
CM
Carlos R. Mafra2009-10-11 17:14:53 +0200184
185___________________
186Example .gitconfig
187-------------------
188
189[user]
190 name = Erwin Schrodinger
191 email = schrodinger@gmail.com
192[core]
193 editor = xjed
194[status]
195 showUntrackedFiles = no
196[color]
197 branch = auto
198 status = auto
199 diff = auto
200 ui = auto
201[apply]
202 whitespace = fix
203
204
205
206
207