November 18, 2008
git as code drop condom
[Continuing with my experiment of posting something every day, I think I'll go with posting photos on MWF and actually writing something on TuTh. Of course, those are minimum goals; maybe I'll get motivated and post even more than that, but the intarwebs can only handle so much of one person's BS, especially if that person is me, so maybe not.]
By now, the hip kids have cottoned onto the fact that git is the new hotness when it comes to managing source code. [Yes, git manages content but I choose to ignore the maniacs who want to use it as a blog or wiki backend or manage their home directory with it or maybe stick it in a pipe and attempt to smoke it just to see what happens.]
So yes, git is fantastic, and if you’re not using it for your own source management, then you have my sincere sympathy that you are doing the equivalent of sticking raw lemons on your eyes every day.
One thing that I’ve found git to be extremely useful for is protecting yourself from, shall we say, unenlightened partners.
If you happen to find yourself in the hellish position between the Scylla of enabling hardware you do not control and the Charybdis of testing 3rd-party vendor-supplied drivers that are supposed to enable said hardware, well, the first thing I would tell you is to get a new job because if you don’t, the only long term answer to reduce the world of hurt you’re experiencing is suicide. But if you need to make mortgage payments for a little while longer, then git is your friend.
For those Web 2.0 wunderkinds who don’t know what a pointer is and whose testes haven’t yet descended, there’s an entire world of software development that doesn’t include the strings “java” or “script” or “extensible”, and consists of, you know, actually booting the machine that runs your lame Facebook app and other boring stuff like transmitting and receiving packets from the “ether nets”.
This world is inhabited by suspender-wearing greybeard overlords and bitter college new hires whose dreams of becoming a physicist were ruined by the soul-crushing mountain of horrible FORTRAN code crapped on their heads in grad school before dropping out of a Ph.D program, thinking that “hey this Linux thing is pretty neat and C is niiice!” but not realizing that they’d only made the 2nd of a long series of bad career moves, choosing a lifetime of bit banging instead of spending 7 minutes to learn “hello world” in Rails and then spending another 10 minutes to make another Google Maps + Craigslist hooker mashup that they could sell for $72 million and spend the rest of their lives doing extreme sports or something equally useless like the Peace Corps.
No, in this world, if you’re lucky, the company you work for actually makes the chip and you get to write the driver. But woe to the extremely unlucky schlep whose company merely integrates the chip into some other device.
This circle of hell typically unfolds as you, the hapless junior programmer, receive a gigantic tarball from clueless $VENDOR, with the latest barfy garbage that they “released” by basically sending you their cvs (or god help you rcs) repository, but without, like, the useful stuff like changelogs or diffs.
And then your fun job is to build their poxy driver, smoosh it into your environment, and then pray that nothing broke. Of course, since god doesn’t exist (if he did, why do you have your current job), inevitably something breaks. Which means you have to puzzle over the pitiful README that they call “release notes” and try and figure out what the hell changed (not that it matters anyway because your company and their company don’t have a common bug tracking system so you just send fifteen thousand emails with kazoollians of sub-threads and random worse-than-useless program managers who get cc’ed at inappropriate times who decide to “help” by cc’ing even more people out of context until basically your company’s global address book is emailing their company’s global address book because their engineer in a more “competitive” geography forgot to byte swap a certain field to take your big-endian system into account. Oops!)
Actually, I’m sorry to break this to you, but even git can’t really help you. It can only make the pain marginally less. And I’m truly talking marginal here; I mean, it’s the difference between swapping bodily fluids with aforementioned Craigslist hookers and smoking crack with them afterwards, or merely taking a pass on the crack. This time.
Anyway, the way to minimize your pain is to take the earliest version of their monolithic tarball that you can find, and:
$ tar zxvf codedrop.tar.gz $ git init $ git add . $ git commit -m "Those schlubs use Visual SourceSafe!?!?"
From this point on, you can now simply untar each new code drop into the same directory and:
$ git commit -a -m "Revision X claims to fix following bugs..."
What you get is a semi-readable changelog, with hopefully manageable diffs. If you really get motivated, you could:
$ tar xzvf codedrop.tar.gz $ git diff # eyeball the changes $ git add -i # interactively add hunks in ways that make sense to you $ git commit -m "I need a new job"
That latter case is useful in case a code drop involves 13k lines of diff that is an ASCII-encoded firmware update in a header file and 40 lines of functional change.
Now, when 6 different program managers are harassing you via Blackberry, asking you “what changed in the driver?” you can give them a reasonable answer (or if you’re feeling vindictive, just send them the output of git diff).
Pray that the baby jesus resurrects himself soon and puts you out of your misery.
