Housekeeping on Thursday, 12th of February, Anno Domini MMIX, at the hour of the...
[git/dscho.git] / blog.rss
blob02e94bba19db1fb2cd31f7578bf7a84658ecfa57
1 <?xml version="1.0" encoding="utf-8"?>
2 <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
3 <channel>
4 <title>Dscho's blog</title>
5 <link>http://repo.or.cz/w/git/dscho.git?a=blob_plain;hb=blog;f=index.html</link>
6 <atom:link href="http://repo.or.cz/w/git/dscho.git?a=blob_plain;hb=blog;f=blog.rss" rel="self" type="application/rss+xml"/>
7 <description>A few stories told by Dscho</description>
8 <lastBuildDate>Thu, 12 Feb 2009 04:29:56 +0100</lastBuildDate>
9 <language>en-us</language>
10 <item>
11 <title>Interactive rebase just learnt a new command: topic</title>
12 <link>http://repo.or.cz/w/git/dscho.git?a=blob_plain;hb=blog;f=index.html#1234409395</link>
13 <guid>http://repo.or.cz/w/git/dscho.git?a=blob_plain;hb=blog;f=index.html#1234409395</guid>
14 <pubDate>Thu, 12 Feb 2009 04:29:55 +0100</pubDate>
15 <description><![CDATA[Interactive <i>rebase</i> just learnt a new command: <i>topic</i>
16 </p><p>
17 Today I am pretty pleased with myself. Two projects at my day job got a real
18 boost, and I implemented a shortcut that avoids the ugly 'bookmark' statement
19 in rebase scripts most of the time.
20 </p><p>
21 A typical rebase script, generated by <i>git rebase -i -p $COMMIT</i> will look
22 something like this:
23 </p><p>
24 <table
25 border=1 bgcolor=white>
26 <tr><td bgcolor=lightblue colspan=3>
27 <pre> </pre>
28 </td></tr>
29 <tr><td>
30 <table cellspacing=5 border=0
31 style="color:black;">
32 <tr><td>
33 <pre>
34 pick 1234567 My first commit
35 topic begin super-cool-feature
36 pick 2345678 The super cool feature
37 pick 3456789 Documentation for the super cool feature
38 topic end super-cool-feature
39 </pre>
40 </td></tr>
41 </table>
42 </td></tr>
43 </table>
44 </p><p>
45 The result will be a merge commit at the HEAD whose first parent is
46 "My first commit", whose second parent is "Documentation for the super
47 cool feature" and whose commit message is "Merge branch 'super-cool-feature'".
48 </p><p>
49 Side note: internally, <i>topic begin $NAME [at $COMMIT]</i> will be handled as if
50 you wrote <i>bookmark merge-parent-of-$NAME; goto $COMMIT</i>, and
51 <i>topic end $NAME [$MESSAGE]</i> will be handled as if you wrote
52 <i>bookmark $NAME; goto merge-parent-of-$NAME; merge parents $NAME [original $MARK Merge branch '$NAME']</i>.
53 </p><p>
54 Of course, being more concise, the 'topic' statement is not only nicer to the
55 eye, but also less error-prone.
56 </p><p>
57 And hopefully many people will agree with me that this rebase script is pretty
58 intuitive.]]></description>
59 </item>
60 <item>
61 <title>Thunderbird, oh Thunderbird, you always make my small brain hurt</title>
62 <link>http://repo.or.cz/w/git/dscho.git?a=blob_plain;hb=blog;f=index.html#1234320806</link>
63 <guid>http://repo.or.cz/w/git/dscho.git?a=blob_plain;hb=blog;f=index.html#1234320806</guid>
64 <pubDate>Wed, 11 Feb 2009 03:53:26 +0100</pubDate>
65 <description><![CDATA[Thunderbird, oh Thunderbird, you always make my small brain hurt
66 </p><p>
67 There was a lengthy discussion on the Git mailing list about using Thunderbird,
68 a not quite unpopular mailing program, to send inline patches.
69 </p><p>
70 It is really kind of sad that the Thunderbird developers do not see how
71 stubbornly they offend quite a number of people and scare them away from their
72 program. After all, you should try to be liberal in what you accept and strict
73 in what you emit. No, that does not mean that you should force others to
74 switch their mailers because you strictly adher to your philosophy in what you
75 emit, ignoring the rest of the world.
76 </p><p>
77 In any case, I am not affected (as long as I do not get mails from a poor soul
78 stuck with Thunderbird).
79 </p><p>
80 But I was a bit mean to that Thunderbird guy I dragged into the discussion, and
81 he seems really offended.
82 </p><p>
83 So I thought I'd give him a real reason to feel offended: I'll just do his work:
84 </p><p>
85 http://<a href=http://repo.or.cz>repo.or.cz</a>/w/UnFlowedThunderbird.git
86 </p><p>
87 It took my free time of two days, being not a Thunderbird developer myself.
88 Hopefully it works, and hopefully some people will feel really ashamed now.]]></description>
89 </item>
90 <item>
91 <title>format-patch --thread and Alpine</title>
92 <link>http://repo.or.cz/w/git/dscho.git?a=blob_plain;hb=blog;f=index.html#1234141489</link>
93 <guid>http://repo.or.cz/w/git/dscho.git?a=blob_plain;hb=blog;f=index.html#1234141489</guid>
94 <pubDate>Mon, 09 Feb 2009 02:04:49 +0100</pubDate>
95 <description><![CDATA[<i>format-patch --thread</i> and Alpine
96 </p><p>
97 I started recently to pipe the output of
98 <i>git format-patch --cover-letter --stdout ...</i> directly into the
99 <i>postponed-msgs</i> folder Alpine uses, instead of pasting files into the
100 mailer.
101 </p><p>
102 The idea is to pretend that I continue a postponed mail, but in reality I
103 never wrote it, <i>format-patch</i> did.
104 </p><p>
105 However, I had problems with the <i>--thread</i> option that is implied by
106 <i>--cover-letter</i>. Alpine always generated new message IDs without adjusting
107 the <i>In-reply-to:</i> and <i>References:</i> headers of the other mails.
108 </p><p>
109 Now I found out that the reason is that the <i>Fcc:</i> headers were missing in
110 the mails, and Alpine generated them, making up new message IDs in the process.
111 </p><p>
112 Therefore I have an alias now which sets not only the <i>Fcc:</i> header, but also
113 the <i>To:</i> headers by rewriting the stream using <i>sed</i>. This is slightly
114 ugly, but so is the handling of headers in <i>format-patch</i>: if you thought
115 you could specify arbitrary headers using the command line, you are mistaken:
116 you can do that only by editing the config.
117 </p><p>
118 While at it, I also noticed a bug whereby <i>--thread --in-reply-to=...</i> simply
119 forgets the <i>--thread</i>. Maybe this week I will find time to address this bug.]]></description>
120 </item>
121 <item>
122 <title>rebase updates</title>
123 <link>http://repo.or.cz/w/git/dscho.git?a=blob_plain;hb=blog;f=index.html#1234140696</link>
124 <guid>http://repo.or.cz/w/git/dscho.git?a=blob_plain;hb=blog;f=index.html#1234140696</guid>
125 <pubDate>Mon, 09 Feb 2009 01:51:36 +0100</pubDate>
126 <description><![CDATA[<i>rebase</i> updates
127 </p><p>
128 Phew. The last few days, I was mainly chasing bugs I introduced due to being
129 too tired to work on the merge-preserving, interactive <i>rebase</i>.
130 </p><p>
131 But finally I have something I can start working with. After my failed
132 experiment to use git-blame to split topic branches, I will sort the commits
133 in my <i>my-next</i> branch into topic branches manually.
134 </p><p>
135 Then I will add an option to <i>rebase -i -p</i> to rewrite refs which point to
136 rewritten commits, so that I can have branches <i>rebase-i-p</i>, <i>add-e</i>, etc
137 and all of them are automatically updated when I <i>rebase -i -p</i> the <i>my-next</i>
138 branch.
139 </p><p>
140 In the process, not only have I learnt the value of the <i>bookmark</i> command,
141 but made quite a few-much needed cleanups (which make
142 <i>git-rebase--interactive.sh</i> longer, but much more understandable).
143 </p><p>
144 Hopefully Stephan will pick the changes in the "rebase protocol" up, and then
145 we can have a sequencer with which I can start to make a graphical interactive
146 rebase using git-gui. Or gitk.
147 </p><p>
148 Maybe.]]></description>
149 </item>
150 <item>
151 <title>The infamous mark command in the rebase command</title>
152 <link>http://repo.or.cz/w/git/dscho.git?a=blob_plain;hb=blog;f=index.html#1234040744</link>
153 <guid>http://repo.or.cz/w/git/dscho.git?a=blob_plain;hb=blog;f=index.html#1234040744</guid>
154 <pubDate>Sat, 07 Feb 2009 22:05:44 +0100</pubDate>
155 <description><![CDATA[The infamous <i>mark</i> command in the <i>rebase</i> command
156 </p><p>
157 I realized today how easy it is to lose commits with the "merge preserving"
158 mode of the interactive rebase. In my case, it was when I tried to move a
159 bunch of commits from the tip of my branch into a topic branch.
160 </p><p>
161 But after moving the commits, I forgot to update the parent of the merge
162 commit. Possibly a mark command could have helped. The very same command
163 I called a nightmare for usability.
164 </p><p>
165 So I was wrong. Big news. &#x263a;
166 </p><p>
167 However, I think that the syntax "mark :1" is something best left for
168 machine consumption, not for human beings.
169 </p><p>
170 But I have an idea: we could use some garbled commit subject, or in case of
171 merge parents, the merge subject as some human readable title of the mark.
172 </p><p>
173 The rebase script would then look something like this:
174 </p><p>
175 <table
176 border=1 bgcolor=white>
177 <tr><td bgcolor=lightblue colspan=3>
178 <pre> </pre>
179 </td></tr>
180 <tr><td>
181 <table cellspacing=5 border=0
182 style="color:black;">
183 <tr><td>
184 <pre>
185 pick abcdefg Some ultra cool commit
186 bookmark ultra-cool
187 goto upstream
188 pick hijklmn Some other cool commit
189 merge parent ultra-cool Merge 'ultra-cool' into master
190 </pre>
191 </td></tr>
192 </table>
193 </td></tr>
194 </table>
195 </p><p>
196 The good news is: I added code that refuses to finish a rebase when there
197 are commits that were rewritten, but not part of the new HEAD's ancestry.]]></description>
198 </item>
199 <item>
200 <title>New valgrind series</title>
201 <link>http://repo.or.cz/w/git/dscho.git?a=blob_plain;hb=blog;f=index.html#1233707628</link>
202 <guid>http://repo.or.cz/w/git/dscho.git?a=blob_plain;hb=blog;f=index.html#1233707628</guid>
203 <pubDate>Wed, 04 Feb 2009 01:33:48 +0100</pubDate>
204 <description><![CDATA[New valgrind series
205 </p><p>
206 I spent quite some time cleaning up that patch series, and feel pretty
207 exhausted.
208 </p><p>
209 Granted, the new <i>git rebase -i -p</i> does its job without complaint so far
210 (so much so that I think I'll release a version of my <i>rebase</i> series
211 soonish), but it <u>is</u> a hassle when you have patches that you have a hard
212 time to decide upon the order/commit boundaries.
213 </p><p>
214 For example, I could imagine that the patch making the location of the
215 templates independent of the location of the Git binaries should come
216 <u>before</u> my patch series, and the valgrind specific part should then
217 be squashed into the first valgrind commit.
218 </p><p>
219 Also, it uses two features of valgrind 3.4.0:
220 </p><p>
221 <ul>
222 <li><i>...</i> in the suppression file, and
223 <li><i>--track-origins=yes</i>
224 </ul>
225 </p><p>
226 The latter is actually the reason I am pretty willing to keep the
227 requirement of that valgrind version, as it is really, really useful.
228 </p><p>
229 I guess we will see what happens to it.]]></description>
230 </item>
231 <item>
232 <title>Problems with split-topic-branches.sh</title>
233 <link>http://repo.or.cz/w/git/dscho.git?a=blob_plain;hb=blog;f=index.html#1233706294</link>
234 <guid>http://repo.or.cz/w/git/dscho.git?a=blob_plain;hb=blog;f=index.html#1233706294</guid>
235 <pubDate>Wed, 04 Feb 2009 01:11:34 +0100</pubDate>
236 <description><![CDATA[Problems with split-topic-branches.sh
237 </p><p>
238 So my little script that should help me to split my topic branches does
239 not work properly.
240 </p><p>
241 First some background: the idea was to let <i>git blame</i> do the hard work
242 to find overlapping changes, i.e. changes that would conflict when
243 changing the order (or skipping the first change, on which the next builds).
244 </p><p>
245 The first problem with that approach: when lines are <u>removed</u> by one
246 commit, and the next commit touches the same location, <i>git blame</i> does
247 not find that the first commit is required by the second.
248 </p><p>
249 Therefore I introduced a really slow reverse thing which tries to find
250 those commits whose removals survived until the parent of a particular
251 commit, but not further.
252 </p><p>
253 However, it does not work properly. Basically, only context sizes that
254 span the whole files lead to conflict-free topic branches so far.
255 </p><p>
256 As a consequence, I think I'll add an option --sprout to the revision
257 walker which will fake octopus merges (or a series of two-parent merges)
258 whenever it finds a perl of non-merge commits that are theoretically
259 independent, i.e. whose patches apply cleanly.]]></description>
260 </item>
261 <item>
262 <title>More valgrind fun</title>
263 <link>http://repo.or.cz/w/git/dscho.git?a=blob_plain;hb=blog;f=index.html#1233277286</link>
264 <guid>http://repo.or.cz/w/git/dscho.git?a=blob_plain;hb=blog;f=index.html#1233277286</guid>
265 <pubDate>Fri, 30 Jan 2009 02:01:26 +0100</pubDate>
266 <description><![CDATA[More valgrind fun
267 </p><p>
268 So I spent quite a number of hours on that funny zlib/valgrind issue. The
269 thing is, zlib people claim that even if their code accesses uninitialized
270 memory, it does not produce erroneous data (by cutting out the results of the
271 uninitialized data, which is cheaper than checking for the end of the buffer
272 in an unaligned manner), so zlib will always be special for valgrind.
273 </p><p>
274 However, the bug I was chasing is funny, and different from said issue. zlib
275 deflates an input buffer to an output buffer that is exactly 58 bytes long.
276 But valgrind claims that the 52nd of those bytes is uninitialized, and <u>only</u>
277 that one.
278 </p><p>
279 But it is not. It must be 0x2c, otherwise zlib refuses to inflate the
280 buffer.
281 </p><p>
282 Now, I went into a debugging frenzy, and finally found out that zlib just
283 passes fine (with the default suppressions because of the "cute" way it
284 uses uninitialized memory), <u>except</u> when it is compiled with UNALIGNED_OK
285 defined.
286 </p><p>
287 Which Ubuntu does, of course. Ubuntu, the biggest forker of all.
288 </p><p>
289 The bad part is that it sounds like a bug in valgrind, and I <u>could</u> imagine
290 that it is an issue of an optimized memcpy() that copies int by int, and
291 that valgrind misses out on the fact that a part of that int is actually
292 <u>not</u> uninitialized.
293 </p><p>
294 But my debugging session's results disagree with that.
295 </p><p>
296 With the help of Julian Seward, the original author of valgrind, I instrumented
297 zlib's source code so that valgrind checks earlier if the byte is initialized
298 or not, to find out where the reason of the issue lies.
299 </p><p>
300 The sad part is that when I added the instrumentation to both the <u>end</u> of
301 the while() loop in compress_block() in zlib's trees.c, and just <u>after</u> the
302 while() loop (whose condition is a plain <i>variable < variable</i> comparison,
303 nothing fancy, certainly not changing any memory), only the <u>latter</u> catches
304 a valgrind error.
305 </p><p>
306 And that is truly strange.]]></description>
307 </item>
308 <item>
309 <title>Interactive stash</title>
310 <link>http://repo.or.cz/w/git/dscho.git?a=blob_plain;hb=blog;f=index.html#1233193467</link>
311 <guid>http://repo.or.cz/w/git/dscho.git?a=blob_plain;hb=blog;f=index.html#1233193467</guid>
312 <pubDate>Thu, 29 Jan 2009 02:44:27 +0100</pubDate>
313 <description><![CDATA[Interactive stash
314 </p><p>
315 There is an easy way to split a patch:
316 </p><p>
317 <table
318 border=1 bgcolor=white>
319 <tr><td bgcolor=lightblue colspan=3>
320 <pre> </pre>
321 </td></tr>
322 <tr><td>
323 <table cellspacing=5 border=0
324 style="color:black;">
325 <tr><td>
326 <pre>
327 $ git reset HEAD^
328 $ git add -i
329 $ git commit
330 $ git diff -R HEAD@{1} | git apply --index
331 $ git commit
332 </pre>
333 </td></tr>
334 </table>
335 </td></tr>
336 </table>
337 </p><p>
338 but it misses out on the fact that the first of both commits does not
339 reflect the state of the working directory at any time.
340 </p><p>
341 So I think something like an interactive <i>stash</i> is needed. A method
342 to specify what you want to keep in the working directory, the rest should
343 be stashed. The idea would be something like this:
344 </p><p>
345 <ol>
346 <li>Add the desired changes into a temporary index.
347 <li>Put the rest of the changes in another temporary index.
348 <li>Stash the latter index.
349 <li>Synchronize the working directory with the first index.
350 <li>Clean up temporary indices.
351 </ol>
352 </p><p>
353 Or in code:
354 </p><p>
355 <table
356 border=1 bgcolor=white>
357 <tr><td bgcolor=lightblue colspan=3>
358 <pre> </pre>
359 </td></tr>
360 <tr><td>
361 <table cellspacing=5 border=0
362 style="color:black;">
363 <tr><td>
364 <pre>
365 $ cp .git/index .git/interactive-stash-1
366 $ GIT_INDEX_FILE=.git/interactive-stash-1 git add -i
367 $ cp .git/index .git/interactive-stash-2
368 $ GIT_INDEX_FILE=.git/interactive-stash-1 git diff -R |
369 (GIT_INDEX_FILE=.git/interactive-stash-2 git apply--index)
370 $ tree=$(GIT_INDEX_FILE=.git/index git write-tree)
371 $ commit=$(echo Current index | git commit-tree $tree -p HEAD)
372 $ tree=$(GIT_INDEX_FILE=.git/interactive-stash-2 git write-tree)
373 $ commit=$(echo Edited out | git commit-tree $tree -p HEAD -p $commit)
374 $ git update-ref refs/stash $commit
375 $ GIT_INDEX_FILE=.git/interactive-stash-1 git checkout-index -a -f
376 $ rm .git/interactive-stash-1 .git/interactive-stash-2
377 </pre>
378 </td></tr>
379 </table>
380 </td></tr>
381 </table>
382 </p><p>
383 This should probably go into <i>git-stash.sh</i>, maybe even with a switch
384 to start git-gui to do the interactive adding instead of git-add.]]></description>
385 </item>
386 <item>
387 <title>Splitting topic branches</title>
388 <link>http://repo.or.cz/w/git/dscho.git?a=blob_plain;hb=blog;f=index.html#1233154567</link>
389 <guid>http://repo.or.cz/w/git/dscho.git?a=blob_plain;hb=blog;f=index.html#1233154567</guid>
390 <pubDate>Wed, 28 Jan 2009 15:56:07 +0100</pubDate>
391 <description><![CDATA[Splitting topic branches
392 </p><p>
393 One might be put off easily by the overarching use of buzzwords in the
394 description of how <i>Darcs</i> works. I, for one, do not expect an intelligent
395 author when I read <i>Theory of patches</i> and <i>based on quantum physics</i>.
396 </p><p>
397 The true story, however, is much simpler, and is actually not that dumb:
398 Let's call two commits "conflicting" when they contain at least one
399 overlapping change.
400 </p><p>
401 The idea is now: Given a list of commits (not a set, as the order is important),
402 to sort them into smaller lists such that conflicting commits are in the
403 sublists ("topic branches") and the sublists are minimal, i.e. no two
404 non-conflicting commits are in the same sublist.
405 </p><p>
406 The idea has flaws, of course, as you can have a patch changing the code,
407 and another changing the documentation, but splitting a list of commits
408 in that way is a first step to sort out my <i>my-next</i> mess, where I have
409 a linear perl of not-necessarily-dependent commits.
410 </p><p>
411 And actually, my whole rebase revamp aimed at the clean-up for my own
412 <i>my-next</i> branch, so I am currently writing a script that can be used
413 as a GIT_EDITOR for git-rebase which implements the Darcs algorithm. Kind of:
414 the result is not implicit, but explicit and can be fixed up later.]]></description>
415 </item>
416 </channel>
417 </rss>