Update Sunday, 8th of March, Anno Domini MMIX, at the hour of the Tiger
[git/dscho.git] / index.html
blob2581135fbe12619e19b7300db71df9572d52a314
1 <html>
2 <head>
3 <title>Dscho's Git log</title>
4 <meta http-equiv="Content-Type"
5 content="text/html; charset=UTF-8"/>
6 </head>
7 <body style="width:800px;background-image:url(dscho.git?a=blob_plain;hb=832be85c785c80202f17b87db7f063ae57ec2cac;f=paper.jpg);background-repeat:repeat-y;background-attachment:scroll;padding:0px;">
8 <div style="width:610px;margin-left:120px;margin-top:50px;align:left;vertical-align:top;">
9 <h1>Dscho's Git log</h1>
10 <div style="position:absolute;top:50px;left:810px;width=400px">
11 <table width=400px bgcolor=#e0e0e0 border=1>
12 <tr><th>Table of contents:</th></tr>
13 <tr><td>
14 <p><ul>
15 <li><a href=#1236479389>08 Mar 2009 New Git for Windows version</a>
16 <li><a href=#1235092615>20 Feb 2009 Code reviews</a>
17 <li><a href=#1234409395>12 Feb 2009 Interactive <i>rebase</i> just learnt a new command: <i>topic</i></a>
18 <li><a href=#1234320806>11 Feb 2009 Thunderbird, oh Thunderbird, you always make my small brain hurt</a>
19 <li><a href=#1234141489>09 Feb 2009 <i>format-patch --thread</i> and Alpine</a>
20 <li><a href=#1234140696>09 Feb 2009 <i>rebase</i> updates</a>
21 <li><a href=#1234040744>07 Feb 2009 The infamous <i>mark</i> command in the <i>rebase</i> command</a>
22 <li><a href=#1233707628>04 Feb 2009 New valgrind series</a>
23 <li><a href=#1233706294>04 Feb 2009 Problems with split-topic-branches.sh</a>
24 <li><a href=#1233277286>30 Jan 2009 More valgrind fun</a>
25 </ul></p>
26 <a href=dscho.git?a=blob_plain;hb=e0559e8e91d1c01a337b56a3ff00234a33106924;f=index.html>Older posts</a>
27 </td></tr></table>
28 <br>
29 <div style="text-align:right;">
30 <a href="dscho.git?a=blob_plain;hb=blog;f=blog.rss"
31 title="Subscribe to my RSS feed"
32 class="rss" rel="nofollow"
33 style="background-color:orange;text-decoration:none;color:white;font-family:sans-serif;">RSS</a>
34 </div>
35 <br>
36 <table width=400px bgcolor=#e0e0e0 border=1>
37 <tr><th>About this blog:</th></tr>
38 <tr><td>
39 <p>It is an active <a href=http://repo.or.cz/w/git/dscho.git?a=blob_plain;f=index.html;hb=5f002cab57a837125a8f901bcd1f3c1477bc3119>abuse</a> of <a href=http://repo.or.cz/>repo.or.cz</a>,
40 letting gitweb unpack the objects in the current tip of the branch <i>blog</i>,
41 including the images and the RSS feed.
42 </p><p>
43 Publishing means running a script that collects the posts, turns them into
44 HTML, makes sure all the images are checked in, and pushes the result.
45 </p><p>
46 This blog also serves to grace the world with Dscho's random thoughts on and
47 around Git.
48 </p>
49 </td></tr></table>
50 <br>
51 <table width=400px bgcolor=#e0e0e0 border=1>
52 <tr><th>Links:</th></tr>
53 <tr><td>
54 <ul>
55 <li> <a href=http://git-scm.com/>Git's homepage</a>
56 <li> <a href=http://gitster.livejournal.com/>Junio's blog</a>
57 <li> <a href=http://www.spearce.org/>Shawn's blog</a> seems to be sitting
58 idle ever since he started working for Google...
59 <li> <a href=http://torvalds-family.blogspot.com/>Linus' blog</a> does not
60 talk much about Git...
61 <li> Scott Chacon's <a href=http://whygitisbetterthanx.com/>Why Git is better
62 than X</a> site
63 <li> <a href=http://vilain.net/>The blog of mugwump</a>
64 <li> <a href=http://blogs.gnome.org/newren/>Elijah Newren</a> chose the
65 same path as Cogito, offering an alternative porcelain (an approach
66 that is doomed in my opinion)
67 <li> <a href=http://msysgit.googlecode.com/>The msysGit project</a>, a (mostly)
68 failed experiment to lure the many Windows developers out there to
69 contribute to Open Source for a change.
70 </ul>
71 </td></tr></table>
72 <br>
73 <table width=400px bgcolor=#e0e0e0 border=1>
74 <tr><th>Google Ads:</th></tr>
75 <tr><td>
76 <script type="text/javascript"><!--
77 google_ad_client = "pub-5106407705643819";
78 /* 300x250, created 1/22/09 */
79 google_ad_slot = "6468207338";
80 google_ad_width = 300;
81 google_ad_height = 250;
82 //-->
83 </script>
84 <script type="text/javascript"
85 src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
86 </script>
87 </td></tr></table>
88 </div>
89 <h6>Sunday, 8th of March, Anno Domini MMIX, at the hour of the Tiger</h6>
90 <a name=1236479389>
91 <h2>New Git for Windows version</h2>
93 <p>
94 </p><p>
95 Phew. That was quite a day, almost exclusively spent on finishing that
96 installer. The worst part: updating GCC seemed not to be such a good idea
97 after all...
98 </p><p>
99 For Windows, we need to use the printf format <i>%I64u</i> (which is
100 non-standard, in the common way of Microsoft) if you want to print 64-bit
101 wide unsigned numbers. The rest of the world accepts the standard <i>%llu</i>.
102 </p><p>
103 After upgrading to the new GCC, a lot of warnings appeared, complaining
104 about <i>%I64u</i>. The warnings went away when I replaced the format with
105 <i>%llu</i>.
106 </p><p>
107 Being the naive I am, I mistook that for a sign that we could finally go
108 more standards-compliant.
109 </p><p>
110 However, it only means that we have to live with the warnings for now, as
111 the C runtime provided on Windows still strongly disagrees with standards
112 (and it has to continue to do so, lest it break existing programs).
113 </p><p>
114 Sigh.
115 </p><p>
116 At least I have the feeling that I caught the most important bugs before
117 releasing.
118 </p>
119 <h6>Friday, 20th of February, Anno Domini MMIX, at the hour of the Buffalo</h6>
120 <a name=1235092615>
121 <h2>Code reviews</h2>
124 </p><p>
125 It has been said that reviewing patches is a most thankless job. As I really
126 like the elegance of Git's source code, and care a lot about it, I did not
127 think that it was thankless, just a little bit tedious (especially when the
128 patch authors mistake criticism for personal attacks).
129 </p><p>
130 Usually, I am pretty good at ignoring insults as responses to my comments;
131 after all, I have a lot more enjoyable things to do than to spend time talking
132 to a guy who shows how wise he is when he thinks that I criticize him
133 <u>personally</u> when I just try to enhance his work, by offering a little bit of
134 my knowledge.
135 </p><p>
136 However, in the last days, three people really seemed to want to insult me,
137 to make me go away, to stop the fun I have with Git.
138 </p><p>
139 And they almost succeeded.
140 </p><p>
141 So I guess it is time to reassess my priorities, and maybe stop reviewing
142 Git patches altogether.
143 </p>
144 <h6>Thursday, 12th of February, Anno Domini MMIX, at the hour of the Tiger</h6>
145 <a name=1234409395>
146 <h2>Interactive <i>rebase</i> just learnt a new command: <i>topic</i></h2>
149 </p><p>
150 Today I am pretty pleased with myself. Two projects at my day job got a real
151 boost, and I implemented a shortcut that avoids the ugly 'bookmark' statement
152 in rebase scripts most of the time.
153 </p><p>
154 A typical rebase script, generated by <i>git rebase -i -p $COMMIT</i> will look
155 something like this:
156 </p><p>
157 <table
158 border=1 bgcolor=black>
159 <tr><td bgcolor=lightblue colspan=3>
160 <pre> </pre>
161 </td></tr>
162 <tr><td>
163 <table cellspacing=5 border=0
164 style="color:white;">
165 <tr><td>
166 <pre>
167 pick 1234567 My first commit
168 topic begin super-cool-feature
169 pick 2345678 The super cool feature
170 pick 3456789 Documentation for the super cool feature
171 topic end super-cool-feature
172 </pre>
173 </td></tr>
174 </table>
175 </td></tr>
176 </table>
177 </p><p>
178 The result will be a merge commit at the HEAD whose first parent is
179 "My first commit", whose second parent is "Documentation for the super
180 cool feature" and whose commit message is "Merge branch 'super-cool-feature'".
181 </p><p>
182 Side note: internally, <i>topic begin $NAME [at $COMMIT]</i> will be handled as if
183 you wrote <i>bookmark merge-parent-of-$NAME; goto $COMMIT</i>, and
184 <i>topic end $NAME [$MESSAGE]</i> will be handled as if you wrote
185 <i>bookmark $NAME; goto merge-parent-of-$NAME; merge parents $NAME [original $MARK Merge branch '$NAME']</i>.
186 </p><p>
187 Of course, being more concise, the 'topic' statement is not only nicer to the
188 eye, but also less error-prone.
189 </p><p>
190 And hopefully many people will agree with me that this rebase script is pretty
191 intuitive.
192 </p>
193 <h6>Wednesday, 11th of February, Anno Domini MMIX, at the hour of the Tiger</h6>
194 <a name=1234320806>
195 <h2>Thunderbird, oh Thunderbird, you always make my small brain hurt</h2>
198 </p><p>
199 There was a lengthy discussion on the Git mailing list about using Thunderbird,
200 a not quite unpopular mailing program, to send inline patches.
201 </p><p>
202 It is really kind of sad that the Thunderbird developers do not see how
203 stubbornly they offend quite a number of people and scare them away from their
204 program. After all, you should try to be liberal in what you accept and strict
205 in what you emit. No, that does not mean that you should force others to
206 switch their mailers because you strictly adher to your philosophy in what you
207 emit, ignoring the rest of the world.
208 </p><p>
209 In any case, I am not affected (as long as I do not get mails from a poor soul
210 stuck with Thunderbird).
211 </p><p>
212 But I was a bit mean to that Thunderbird guy I dragged into the discussion, and
213 he seems really offended.
214 </p><p>
215 So I thought I'd give him a real reason to feel offended: I'll just do his work:
216 </p><p>
217 http://<a href=http://repo.or.cz>repo.or.cz</a>/w/UnFlowedThunderbird.git
218 </p><p>
219 It took my free time of two days, being not a Thunderbird developer myself.
220 Hopefully it works, and hopefully some people will feel really ashamed now.
221 </p>
222 <h6>Monday, 9th of February, Anno Domini MMIX, at the hour of the Buffalo</h6>
223 <a name=1234141489>
224 <h2><i>format-patch --thread</i> and Alpine</h2>
227 </p><p>
228 I started recently to pipe the output of
229 <i>git format-patch --cover-letter --stdout ...</i> directly into the
230 <i>postponed-msgs</i> folder Alpine uses, instead of pasting files into the
231 mailer.
232 </p><p>
233 The idea is to pretend that I continue a postponed mail, but in reality I
234 never wrote it, <i>format-patch</i> did.
235 </p><p>
236 However, I had problems with the <i>--thread</i> option that is implied by
237 <i>--cover-letter</i>. Alpine always generated new message IDs without adjusting
238 the <i>In-reply-to:</i> and <i>References:</i> headers of the other mails.
239 </p><p>
240 Now I found out that the reason is that the <i>Fcc:</i> headers were missing in
241 the mails, and Alpine generated them, making up new message IDs in the process.
242 </p><p>
243 Therefore I have an alias now which sets not only the <i>Fcc:</i> header, but also
244 the <i>To:</i> headers by rewriting the stream using <i>sed</i>. This is slightly
245 ugly, but so is the handling of headers in <i>format-patch</i>: if you thought
246 you could specify arbitrary headers using the command line, you are mistaken:
247 you can do that only by editing the config.
248 </p><p>
249 While at it, I also noticed a bug whereby <i>--thread --in-reply-to=...</i> simply
250 forgets the <i>--thread</i>. Maybe this week I will find time to address this bug.
251 </p>
252 <h6>Monday, 9th of February, Anno Domini MMIX, at the hour of the Buffalo</h6>
253 <a name=1234140696>
254 <h2><i>rebase</i> updates</h2>
257 </p><p>
258 Phew. The last few days, I was mainly chasing bugs I introduced due to being
259 too tired to work on the merge-preserving, interactive <i>rebase</i>.
260 </p><p>
261 But finally I have something I can start working with. After my failed
262 experiment to use git-blame to split topic branches, I will sort the commits
263 in my <i>my-next</i> branch into topic branches manually.
264 </p><p>
265 Then I will add an option to <i>rebase -i -p</i> to rewrite refs which point to
266 rewritten commits, so that I can have branches <i>rebase-i-p</i>, <i>add-e</i>, etc
267 and all of them are automatically updated when I <i>rebase -i -p</i> the <i>my-next</i>
268 branch.
269 </p><p>
270 In the process, not only have I learnt the value of the <i>bookmark</i> command,
271 but made quite a few-much needed cleanups (which make
272 <i>git-rebase--interactive.sh</i> longer, but much more understandable).
273 </p><p>
274 Hopefully Stephan will pick the changes in the "rebase protocol" up, and then
275 we can have a sequencer with which I can start to make a graphical interactive
276 rebase using git-gui. Or gitk.
277 </p><p>
278 Maybe.
279 </p>
280 <h6>Saturday, 7th of February, Anno Domini MMIX, at the hour of the Pig</h6>
281 <a name=1234040744>
282 <h2>The infamous <i>mark</i> command in the <i>rebase</i> command</h2>
285 </p><p>
286 I realized today how easy it is to lose commits with the "merge preserving"
287 mode of the interactive rebase. In my case, it was when I tried to move a
288 bunch of commits from the tip of my branch into a topic branch.
289 </p><p>
290 But after moving the commits, I forgot to update the parent of the merge
291 commit. Possibly a mark command could have helped. The very same command
292 I called a nightmare for usability.
293 </p><p>
294 So I was wrong. Big news. &#x263a;
295 </p><p>
296 However, I think that the syntax "mark :1" is something best left for
297 machine consumption, not for human beings.
298 </p><p>
299 But I have an idea: we could use some garbled commit subject, or in case of
300 merge parents, the merge subject as some human readable title of the mark.
301 </p><p>
302 The rebase script would then look something like this:
303 </p><p>
304 <table
305 border=1 bgcolor=black>
306 <tr><td bgcolor=lightblue colspan=3>
307 <pre> </pre>
308 </td></tr>
309 <tr><td>
310 <table cellspacing=5 border=0
311 style="color:white;">
312 <tr><td>
313 <pre>
314 pick abcdefg Some ultra cool commit
315 bookmark ultra-cool
316 goto upstream
317 pick hijklmn Some other cool commit
318 merge parent ultra-cool Merge 'ultra-cool' into master
319 </pre>
320 </td></tr>
321 </table>
322 </td></tr>
323 </table>
324 </p><p>
325 The good news is: I added code that refuses to finish a rebase when there
326 are commits that were rewritten, but not part of the new HEAD's ancestry.
327 </p>
328 <h6>Wednesday, 4th of February, Anno Domini MMIX, at the hour of the Buffalo</h6>
329 <a name=1233707628>
330 <h2>New valgrind series</h2>
333 </p><p>
334 I spent quite some time cleaning up that patch series, and feel pretty
335 exhausted.
336 </p><p>
337 Granted, the new <i>git rebase -i -p</i> does its job without complaint so far
338 (so much so that I think I'll release a version of my <i>rebase</i> series
339 soonish), but it <u>is</u> a hassle when you have patches that you have a hard
340 time to decide upon the order/commit boundaries.
341 </p><p>
342 For example, I could imagine that the patch making the location of the
343 templates independent of the location of the Git binaries should come
344 <u>before</u> my patch series, and the valgrind specific part should then
345 be squashed into the first valgrind commit.
346 </p><p>
347 Also, it uses two features of valgrind 3.4.0:
348 </p><p>
349 <ul>
350 <li><i>...</i> in the suppression file, and
351 <li><i>--track-origins=yes</i>
352 </ul>
353 </p><p>
354 The latter is actually the reason I am pretty willing to keep the
355 requirement of that valgrind version, as it is really, really useful.
356 </p><p>
357 I guess we will see what happens to it.
358 </p>
359 <h6>Wednesday, 4th of February, Anno Domini MMIX, at the hour of the Buffalo</h6>
360 <a name=1233706294>
361 <h2>Problems with split-topic-branches.sh</h2>
364 </p><p>
365 So my little script that should help me to split my topic branches does
366 not work properly.
367 </p><p>
368 First some background: the idea was to let <i>git blame</i> do the hard work
369 to find overlapping changes, i.e. changes that would conflict when
370 changing the order (or skipping the first change, on which the next builds).
371 </p><p>
372 The first problem with that approach: when lines are <u>removed</u> by one
373 commit, and the next commit touches the same location, <i>git blame</i> does
374 not find that the first commit is required by the second.
375 </p><p>
376 Therefore I introduced a really slow reverse thing which tries to find
377 those commits whose removals survived until the parent of a particular
378 commit, but not further.
379 </p><p>
380 However, it does not work properly. Basically, only context sizes that
381 span the whole files lead to conflict-free topic branches so far.
382 </p><p>
383 As a consequence, I think I'll add an option --sprout to the revision
384 walker which will fake octopus merges (or a series of two-parent merges)
385 whenever it finds a perl of non-merge commits that are theoretically
386 independent, i.e. whose patches apply cleanly.
387 </p>
388 <h6>Friday, 30th of January, Anno Domini MMIX, at the hour of the Buffalo</h6>
389 <a name=1233277286>
390 <h2>More valgrind fun</h2>
393 </p><p>
394 So I spent quite a number of hours on that funny zlib/valgrind issue. The
395 thing is, zlib people claim that even if their code accesses uninitialized
396 memory, it does not produce erroneous data (by cutting out the results of the
397 uninitialized data, which is cheaper than checking for the end of the buffer
398 in an unaligned manner), so zlib will always be special for valgrind.
399 </p><p>
400 However, the bug I was chasing is funny, and different from said issue. zlib
401 deflates an input buffer to an output buffer that is exactly 58 bytes long.
402 But valgrind claims that the 52nd of those bytes is uninitialized, and <u>only</u>
403 that one.
404 </p><p>
405 But it is not. It must be 0x2c, otherwise zlib refuses to inflate the
406 buffer.
407 </p><p>
408 Now, I went into a debugging frenzy, and finally found out that zlib just
409 passes fine (with the default suppressions because of the "cute" way it
410 uses uninitialized memory), <u>except</u> when it is compiled with UNALIGNED_OK
411 defined.
412 </p><p>
413 Which Ubuntu does, of course. Ubuntu, the biggest forker of all.
414 </p><p>
415 The bad part is that it sounds like a bug in valgrind, and I <u>could</u> imagine
416 that it is an issue of an optimized memcpy() that copies int by int, and
417 that valgrind misses out on the fact that a part of that int is actually
418 <u>not</u> uninitialized.
419 </p><p>
420 But my debugging session's results disagree with that.
421 </p><p>
422 With the help of Julian Seward, the original author of valgrind, I instrumented
423 zlib's source code so that valgrind checks earlier if the byte is initialized
424 or not, to find out where the reason of the issue lies.
425 </p><p>
426 The sad part is that when I added the instrumentation to both the <u>end</u> of
427 the while() loop in compress_block() in zlib's trees.c, and just <u>after</u> the
428 while() loop (whose condition is a plain <i>variable < variable</i> comparison,
429 nothing fancy, certainly not changing any memory), only the <u>latter</u> catches
430 a valgrind error.
431 </p><p>
432 And that is truly strange.
433 </p>
434 </div>
435 </body>
436 </html>