<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="/feed.xml" rel="self" type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" /><updated>2024-11-09T23:03:26+00:00</updated><id>/feed.xml</id><title type="html">Nasamuffin’s Geocities Page</title><subtitle>Hopefully-useful content regarding open source development, Git, bash, regex, vim, and other silly command line wizardry. Primarily exists to be linked to from Twitter.</subtitle><entry><title type="html">Two Weeks In: Roundup</title><link href="/leave/books/knitting/games/roundup/2024/11/09/two-week-roundup.html" rel="alternate" type="text/html" title="Two Weeks In: Roundup" /><published>2024-11-09T00:00:00+00:00</published><updated>2024-11-09T00:00:00+00:00</updated><id>/leave/books/knitting/games/roundup/2024/11/09/two-week-roundup</id><content type="html" xml:base="/leave/books/knitting/games/roundup/2024/11/09/two-week-roundup.html"><![CDATA[<p>It’s been two weeks of leave so far! Here’s a roundup of what I’ve been up to.</p>

<h2 id="cooking">Cooking</h2>

<p>I’ve been doing a lot more cooking these two weeks! In no particular order
and as I can remember:</p>

<ul>
  <li>Sour cherry and vanilla scones</li>
  <li>French toast en masse</li>
  <li>Butternut squash pasta</li>
  <li>Winter roots pasta</li>
  <li>Pumpkin spice honey</li>
  <li>Experimenting with <a href="https://books.google.com/books/about/Freezer_Door_Cocktails.html">freezer cocktails</a></li>
  <li>Mushroom stroganoff</li>
</ul>

<p>Later today we’re doing rack of lamb and Indian bitter melon.</p>

<h2 id="reading">Reading</h2>

<p>I couldn’t resist a very cute, very tiny box set of The Hobbit + LOTR to
celebrate the beginning of my sabbatical. I’m in the middle of The Hobbit now,
but it’s slow going because I’ve been much more focused on knitting and
videogames. In the last couple weeks I also read:</p>

<h3 id="a-prayer-for-the-crown-shy-becky-chambers">A Prayer for the Crown-Shy, Becky Chambers</h3>

<p><a href="https://www.goodreads.com/book/show/40864030-a-prayer-for-the-crown-shy">goodreads</a></p>

<p>I have a cute little hardbound copy of Psalm for the Wild Built, the predecessor
to this book, but when I bought it Books Inc didn’t have this one. So, as I
biked to my last day of work til Christmastime, I forgot to pack the book I was
actually reading (Spinning Silver) and needed something to do at the bar for
a couple hours, as I quit work around 1 instead of holding out til 4. But this
one jumped out at me at Leigh’s - it was on the shelf without its counterpart,
and a book about burnout and whether we really have to find purpose seemed so
apropos for the beginning of my journey that I bought it. I read it in one
sitting at the bar - just enough time for me to wait for my partner and his
coworkers to show up in the afternoon.</p>

<h3 id="spinning-silver-naomi-novik">Spinning Silver, Naomi Novik</h3>

<p><a href="https://www.goodreads.com/book/show/36896898-spinning-silver">goodreads</a></p>

<p>I read the Scholomance trilogy a couple of years ago and LOVED it, but I hadn’t
read any of Naomi Novik’s fairytale retellings. I liked this one quite a lot -
it didn’t catch me so much at first, but by the second half I was riveted. It’s
a really fascinating blend of fantasy and reality - Miryem, one of the protags,
has to contend with both obnoxious winter fae <em>and</em> anti-semitism from her
neighbors. Figuring out the mechanics of the magical world and spells around
them, then using those mechanics to their advantage to prevail over evil,
resulting in prosperity and true love for all. This was just a really fun read,
by the end.</p>

<h3 id="next">Next…</h3>

<p>So it’s been a bit slow - again, I’ve been focusing on other things. After
The Hobbit, next in line is <a href="https://www.goodreads.com/book/show/45047384-the-house-in-the-cerulean-sea">The House in the Cerulean Sea</a>
by T.J. Klune, and a date with a coffee, a brainless knitting project, and
<a href="https://www.goodreads.com/book/show/156558.Knitting_Without_Tears">Knitting Without Tears</a>
by the formative Elizabeth Zimmerman. I’m intending to take another stab at
reading LOTR in print - previously I’ve only successfully finished them via
audiobook - and will likely bring the rest of the set with me to Vermont next
week.</p>

<h2 id="videogames">Videogames</h2>

<p>It has been a good few weeks for games. I find them more engaging than reading
a book (unsurprisingly), and this week I’ve needed a lot of distraction and
comfort. So I’ve been playing:</p>

<h3 id="satisfactory">Satisfactory</h3>

<p>My partner and I are around 90 hours into our shared save, working on delivering
the Stage 5 components and finally Saving the Day. However, it’s started
crashing and generally being odd in multiplayer, so I think we may be done for
now. The last bug-fixing patch repopulated all of the world exploration
collectibles…which, honestly, kind of sucks.</p>

<h3 id="tavern-talk">Tavern Talk</h3>

<p>A cute little visual novel a la Coffee Talk. I only did one playthrough and got
the true ending; to get the rest of the achievements I’d need to play it again
and make mostly opposite choices, then play it at least once more to get the
secret bad ending. I’m not sure I want to spend the time - it’s long and
pretty linear.</p>

<h3 id="the-witness">The Witness</h3>

<p>I finally rolled credits on The Witness! Not much to say here - there were
literally three puzzles between me and credits. I looked up the answer to one
of them, I’m sorry to say. I was also reminded why I had such a hard time
playing this before - something about this particular perspective and camera
effects gives me the super nausea. So, I won’t go and do the secret time trial
stuff at the end, I’ll call this good enough and hang onto the happy memory.</p>

<h3 id="a-little-to-the-left">A Little to the Left</h3>

<p>Oh my goodness this game is SO FUN!!! I enjoyed beating it over a couple
evenings. The puzzles are not hard enough that you feel stumped or need a pen
and paper, but not so easy that it feels purely like a time filler. I played
both DLCs, which I felt were worse quality than the main game, but still a good
time.</p>

<h3 id="fields-of-mistria">Fields of Mistria</h3>

<p>And here it is. This is the reason I haven’t been reading. After Trump got
elected this week, by a popular majority too, my general sense of anxiety and
dread has spiked. So I was searching for a cozy blanket of a game to help with
the anxiety before I can even start thinking about taking action - and this
game nails it.</p>

<p>It is, of course, Yet Another Farming Sim. It has the pixel graphics, like
Stardew Valley. It has crops, and cows, and chickens, and a bathhouse, and all
the things. But it <em>also</em> has thirst traps! My biggest complaint about SDV is
that the entire romance/friendship portion doesn’t appeal to me, because all of
the people of Stardew Valley are obnoxious, terrible people. But it’s okay - all
of the people of Mistria are hotties made out of fandom tropes.</p>

<p>So, instead of reading books, I’ve been alternately bribing the tsundere
rival-to-lover blacksmith with 90’s anime hair so that he’ll admit he loves me,
and reading fanfic about said blacksmith angstily admitting he loves the farmer.
It’s been… really nice.</p>

<p>Also, the fishing game is much less painful than SDV’s, and the combat is a
little better (but still not great). I do still tend to prefer combat-free
cozy farming sims, but thanks to SDV the dungeoneering aspect seems to be
considered a requirement. Alas.</p>

<h2 id="the-master-hand-knitter-program">The Master Hand Knitter Program</h2>

<p>I’ve made huge progress these two weeks! And yet, I’m somehow close to where I
was when I started my leave. I decided to reknit almost all of the swatches,
and I’m absolutely tickled with the improvement I got by doing so. I got a bit
further into the questions, and I redid the gauge sheets and did a bit of
writing there. I also noticed requirements I hadn’t before, like that the
paper is supposed to be 1500-2000 words and I had written 2600, so I did some
major editing there as well.</p>

<p>As of now, I’m on question 5(?) out of ~22, and I need to knit the mitten. It
was tough to focus this week around the fascism and the dog errands, so I feel
like it wasn’t as productive as last week, and I’ll be heading to the library
on Sunday to try and put in a full day of question-answering and researching.</p>

<p>I’m still hoping I can get the mitten done and the package out the door before
I go to Vermont, but it’s seeming less likely. Perhaps at least I can have my
research materials all sorted so I don’t need to take as much shit on the train.
We’ll see. Or, maybe I’ll take a break from it and only bring Zach’s kid’s
stocking with me, and finish that on the train instead.</p>

<h2 id="other-stuff">Other stuff</h2>

<p>The other big fun thing is that this week I went with a dear friend to the
Team USA vs. Team Canada women’s national hockey team Rivalry Series game in
San Jose. The turnout was just okay, so the energy at the arena left a little
to be desired, but I got to sit with my friend’s recreational adult women’s
hockey league, which was a TON of fun. Also, I actually saw a few other people
in California wearing PWHL gear - a first for me. Also also, I got to drink a
beer out of a hockey stick. It was unbelievably stupid.</p>

<p>This week the USA elected Trump as our next president. I usually find
political posts after events like this to feel useless or insincere, but I guess
I’ll state that I’m incredibly disappointed to see even the popular vote going
towards Trump, and I’m pretty worried for the future. The best way to get
through it, I think, is at the local community level, so I’ll be trying to be
more engaged there. Other than that, I’m not sure what to do besides take care
of myself and prepare for the worst.</p>

<h2 id="up-next">Up Next</h2>

<p>Next week I leave for Vermont. 4 days on the Amtrak, 4 days baking, then flying
home in time to get all sorted for Thanksgiving. This year it seems like we will
have 11-13 people at Thanksgiving!!! So I’m trying to figure out the food and
especially seating for that. Very, very excited for it all. And hopefully I’ll
remember to keep posting through it.</p>]]></content><author><name></name></author><category term="leave" /><category term="books" /><category term="knitting" /><category term="games" /><category term="roundup" /><summary type="html"><![CDATA[It’s been two weeks of leave so far! Here’s a roundup of what I’ve been up to.]]></summary></entry><entry><title type="html">Fall Butternut Squash Pasta</title><link href="/leave/cooking/2024/11/02/fall-butternut-pasta.html" rel="alternate" type="text/html" title="Fall Butternut Squash Pasta" /><published>2024-11-02T00:00:00+00:00</published><updated>2024-11-02T00:00:00+00:00</updated><id>/leave/cooking/2024/11/02/fall-butternut-pasta</id><content type="html" xml:base="/leave/cooking/2024/11/02/fall-butternut-pasta.html"><![CDATA[<p>On my very scientific Mastodon poll, a handful of people said they’d like to see
food updates. So here’s a food update!</p>

<p>This morning we went to the farmer’s market in search of inspiring vegetables.
And the market delivered! The veggie stalls have started to get their gourds in,
which means I couldn’t resist the hilariously-oversized butternut squash. I even
made my partner run back to the ATM to get cash for it, since neither of us came
prepared. Knowing I wanted to make a creamy squash pasta, we went on the hunt -
and found some lovely curly kale and a brick of cow’s feta, too. (Also, coffee!)</p>

<p><img src="https://i.imgur.com/FnqxKiR.jpeg" alt="The squash in question. It's about 10&quot; long and 5 or 6 inches in diameter. The
photo features this monster squash on a cute wooden chevron cutting board, along
with a head of garlic and a nicely round white onion. And my vegetable cleaver,
which is 6&quot; long, 4&quot; tall, all carbon steel and sharp." /></p>

<p>I’ve got plans at 6, so I wanted to have a slightly early dinner.  So I tore
myself away from <a href="https://store.steampowered.com/app/2076140/Tavern_Talk/">Tavern Talk</a>
around 2 and broke down the squash for roasting. Squash huge. Squash tough. But
it turned to rust on my blade, as it were, and soon it was in the oven roasting
to get some nice brown flavor on top, along with some garlic and red pepper.</p>

<p><img src="https://i.imgur.com/rKEDQIz.jpeg" alt="In the middle of breaking down the squash. The narrower top is separated into
quarters next to my cleaver, and the rounder bottom is sitting on the cutting
board judging me." /></p>

<p><img src="https://i.imgur.com/pt1oith.jpeg" alt="A rimmed sheet pan, stuffed full of slices of butternut squash. It's been
brushed with oil and sprinkled with salt and red pepper flake, and a few garlic
cloves are visible here and there. There's not a lot of breathing room." /></p>

<p>I had meant to roast the onions too, but there literally was not room on the
pan, so I sliced up the onions to saute at the same time as the ground lamb,
instead. After some musing about kale as the mathematician’s vegetable, I
remembered that I also had some fresh thyme from last week’s winter root pasta,
so I stripped a ton of that too.</p>

<p><img src="https://i.imgur.com/ry1BLFS.jpeg" alt="Mise en place for the saute. A big bowl of chopped curly kale, a medium bowl
of longitudinally sliced white onion, and a tiny bowl of fresh thyme leaves." /></p>

<p>Weirdly, it’s a lot easier to cook ground meat without it turning into big
chunks if you thaw it all the way first. Who knew? Also, at this time I
remembered the half jar of sundried tomatoes, so those went in too. Yum.</p>

<p><img src="https://i.imgur.com/7jg7gBF.jpeg" alt="Partially-cooked ground lamb, in the bottom of an enameled dutch oven with
some partially-cooked onion and sundried tomatoes." /></p>

<p>The squash came out and went into the blender, then into the meat, and I had a
bit of time for a simmer while the pasta water heated up.</p>

<p><img src="https://i.imgur.com/0wjy7hW.jpeg" alt="Cooked squash (and garlic) on a sheet pan. Some of it looks brown and crispy,
but mostly it just looks slightly caramelized and fully cooked." /></p>

<p><img src="https://i.imgur.com/oQMQ60B.jpeg" alt="A dutch oven full of yellow sauce flecked with green, while a pot of pasta
cooks on the back burner. All the pots are red and cute, but they're from
different manufacturers, because same is boring. I like the brief moment of
calm." /></p>

<p>Et voila! I stirred in the feta and a bit more pasta water at the same time as
the thyme and the cooked pasta, and the whole thing came out a little sweet,
very hearty and savory. We had it with some old vine zinfandel that my partner
went out for, and they paired very nicely. Yum :)</p>

<p><img src="https://i.imgur.com/aJWGWk4.jpeg" alt="A shallow bowl full of rigatoni tossed with yellow pasta sauce, studded with
cooked ground lamb, streaks of half-melted feta, and spinach. It's garnished
with some fresh thyme leaf, and a square stemless glass of red wine in the
background." /></p>]]></content><author><name></name></author><category term="leave" /><category term="cooking" /><summary type="html"><![CDATA[On my very scientific Mastodon poll, a handful of people said they’d like to see food updates. So here’s a food update!]]></summary></entry><entry><title type="html">Deciding to Reknit the MHK Swatches</title><link href="/leave/knitting/2024/10/31/reknitting-swatches.html" rel="alternate" type="text/html" title="Deciding to Reknit the MHK Swatches" /><published>2024-10-31T00:00:00+00:00</published><updated>2024-10-31T00:00:00+00:00</updated><id>/leave/knitting/2024/10/31/reknitting-swatches</id><content type="html" xml:base="/leave/knitting/2024/10/31/reknitting-swatches.html"><![CDATA[<p>The <a href="https://tkga.org/certification/master-hand-knitting/">Master Hand Knitting</a>
Level 1 application involves, among other things, 18 swatches demonstrating good
execution of a handful of techniques. I knitted these 18 swatches back in 2022,
when I was much more optimistic (blind?) about the quality of my knitting. Sure,
I thought, it looks a little like this “rowing out” thing on the edges, but it’s
not that bad and the evaluators won’t notice!</p>

<p>But looking again with fresh eyes in 2024, I was wrong, wrong, wrong. I row out,
and it’s quite obvious.</p>

<p>Here’s my Swatch #2 from 2022 - 1x1 rib followed by stockinette. I’ve taken a
photo of the wrong side, and you can see the distinct “gutters” coming out:</p>

<p><img src="https://i.imgur.com/37f1F90.jpeg" alt="An off-white knit swatch, purl-bumps-up, on a foam mat. Pairs of purl bump
rows are grouped together with distinctive &quot;gutters&quot; between them, but only at
the edges of the work; the middle of the work is consistent and smooth." /></p>

<p>These are a little more obvious when the fabric is stretched out:</p>

<p><img src="https://i.imgur.com/zkwnCJi.jpeg" alt="The same swatch, still wrong-side-up, pinned open to stretch out the edge.
The purl bump rows &quot;pair up&quot;, tugging towards each other and away from the pairs
on either side." /></p>

<p>It’s visible on the front side, too; the selvedge column is expected to be wonky
but the column of stitches <em>next to</em> the selvedge ought to be tidy. Instead,
mine has stitches that alternate between tight and loose, making a noticeable,
regular pattern on the right side:</p>

<p><img src="https://i.imgur.com/VQSRFG9.jpeg" alt="The same knit swatch, right side up. The second-to-edge row of knitting has
some stitches that are large with an exaggerated loop, and some that are regular
sized." /></p>

<p>The more I stared at these, and the more I answered the question packet about
how evil these are and how to fix them, the more I longed to throw out all my
knitted work from 2022 and start again - after figuring out what I’m doing
wrong.</p>

<h3 id="diagnosis">Diagnosis</h3>

<p>The questions worksheet that comes with the MHK packet kind of leads you to sort
out your own ills. You spend a lot of time evaluating your own knitting, before
it ever goes in the mail for the experts. And you read, read, read. Some
questions are posed like you’re answering them to help someone else, which in
this case helped me realize I need to help me, too! And you need to cite all
your sources - which is how I started my own diagnosis.</p>

<p>The question asked, paraphrased, specifically how a knitter with edge gutters
could solve their tension problems. I started with my new favorite knitting
hack book - Patty Lyons’
<a href="https://www.goodreads.com/en/book/show/60899306-patty-lyons-knitting-bag-of-tricks">Knitting Bag of Tricks</a>.
Patty describes the source of this problem as a loose last stitch of the row,
and to solve it, she has you tug the first stitch of the next row, transferring
the tug into the yarn from the last of the previous row to neaten up that
stitch. So I cast on a little microswatch and tried it out - but I quickly
realized that this problem Patty describes is not the problem I’m having!</p>

<p>Instead of having a tidy first stitch and a messy stitch last stitch, I noticed
that even with Patty’s hack I still had gutters. In fact, my “pairs” of purl
bumps were just bound together more tightly and the gutters between them were
<em>more</em> obvious!  I realized that instead, the problem was that as I reached the
end of every row, the last stitch I wanted to knit into - that is, the first
stitch of the previous row - was loose and baggy. No good!</p>

<p>So I tried a hack that I used in my MHK swatches in 2022 to neaten up the
bindoff - working the first stitch of the row below wrapping backwards, to get
rid of some of the extra yarn. I did another section of my microswatch this way,
hoping to solve it on my own without extra sources (I’m like this, I don’t know
why), but the problem persisted.</p>

<p>I kept digging. I watched a video (eurgh!) by Heather Sorta, who is certified
through the same program that I’m working on. In her video on
<a href="https://heatherstorta.com/2020/09/18/tension-issues-rowing-out/">tension issues</a>,
Heather explains that this happens because, as you knit the row, a bit of slack
on each stitch in the row below gets tugged into the next stitch, and the next,
and the next, until you have a big old gappy last stitch with nowhere for that
yarn to go. She suggests wrapping the first <em>handful</em> of stitches backwards on
each row.  Sounds handy, but I had one problem with this description. She
suggests that every wrapped-backwards (Eastern wrapped) stitch is, by nature,
tighter than each wrapped-forwards (Western wrapped) stitch. And I just don’t
think that’s true!</p>

<p>Rather, I can observe in my own knitting that the part of changing wrap
direction that makes stitches smaller is the <em>transition</em> between wrap
directions. Think about it - if you knit 3 stitches Western-wrapped, your yarn
spirals all the way around your needle 3 times. If you knit 3 stitches
Eastern-wrapped, your yarn spirals all the way around your needle 3 times, but
in the opposite direction. But when you knit Eastern, then Western, then
Eastern, your yarn actually doesn’t spiral all the way around the needle - it
zigzags, turning a sharp corner at each pair of legs where it reverses
direction. Hopefully this photo illustrates it:</p>

<p><img src="https://i.imgur.com/pXpK6yD.jpeg" alt="About a dozen stitches mounted on a needle. The first six change wrap
direction back and forth, but only the last switch - the fifth and sixth
stitches - is really visibly pulling the legs forward on the stitches below." /></p>

<p>It’s not totally clear, because the front of the fabric doesn’t warp as much
when working this way, but I find it much more obvious looking at the purl side:</p>

<p><img src="https://i.imgur.com/B9pI8tX.jpeg" alt="The purl side of a stockinette swatch, only the first nine stitches knitted.
The wrap direction reverses every other stitch for the first five stitches or
so; stitches 2 and 3 are paired tightly together, with the corner in the yarn
visible, as are stitches 4 and 5. It's clear the yarn doesn't wrap all the way
around the needle, but reverses direction." /></p>

<p>From the purl side, you can see where the yarn turns around - look at the 2-3
and 4-5 stitches in that shot. The heads of the stitches below are pulled into
a noticeable chevron shape, and the yarn only makes it around maybe 3/4 of the
needle circumference before turning around and heading back.</p>

<h3 id="fixing-my-own-knitting">Fixing My Own Knitting</h3>

<p>For me, this problem was pretty pronounced, and I already knit quite tightly
so just one reverse-wrap like I had tried before wasn’t cutting the mustard.
So I swatched - it <em>is</em> Halloween, after all - until I came up with the right
number of wraps. When starting a purl row - that is, the row I’m going to knit
into later - I wrap regular, reverse, regular, reverse, regular. So I get 4
direction changes waiting for me at the end of the every knit row. However, for
rows I’m purling into, I found this wasn’t quite enough; instead, when I start
a knit row, I wrap reverse, regular, reverse, regular, reverse, regular. That
leaves me with, by my guesstimation, about 5.5 reversals. (The one at the
beginning of the row kinda counts, but I think isn’t as pronounced, since the
yarn is traveling vertically no matter what.)</p>

<p>The results had me skipping with glee and knitting a full length swatch to show
off.</p>

<p>Lo, the wrong side, gutter-free, even when stretched:</p>

<p><img src="https://i.imgur.com/MzolAR4.jpeg" alt="The new swatch, pinned flat but not stretched, wrong-side-up. There are no
visible gutters between rows of purl bumps - it's just a uniformly bumpy
surface." /></p>

<p><img src="https://i.imgur.com/YXpEdsI.jpeg" alt="The new swatch, now pinned stretched a little open. Each purl bump row stands
confidently on its own; there's no &quot;pairing&quot; and the gap between purl rows is
uniform." /></p>

<p>And the right side! So visually tidy! Here’s the “knitting into” side:</p>

<p><img src="https://i.imgur.com/pXXOAJF.jpeg" alt="The edge of the right side of the new swatch. It's pinned flat but not
stretched. The stitches next to the selvedge column are uniform in size and
there is no visual repeating pattern of overlarge stitches." /></p>

<p>The “purling into” side is still a little bit distorted; on the game time
swatches I may adjust my method so I’m working 6 full reversals into the
beginning of each row instead.</p>

<p><img src="https://i.imgur.com/rg8JPxl.jpeg" alt="The other edge of the right side of the new swatch. It's pinned flat, but
not stretched open. The stitches are fairly uniform, but maybe there are a few
overlarge stitches here and there." /></p>

<p>So my takeaway is so: <strong>the ends of my rows are fine, but the beginnings are
loose. And I probably pull the stitches too far open when working, making the
looseness gather even worse in the end of each row.</strong> The solutions that Patty
suggests are for the opposite problem from the one I have, so when I’m carefully
tightening the first stitches of each row, I need to also be careful not to tug
on the last stitch from the row before, which tightens a stitch that is already
at the correct tension.</p>

<h2 id="so-now-what">So Now What?</h2>

<p>This problem shows up in nearly all my swatches from the MHK program. There are
a scant few swatches that don’t have stockinette all the way up to the edge:
one that’s mostly garter with a bit of 2x2 ribbing, and one that’s all seed.
The seed one looks fine. The garter itself is fine, but edges of my rib show
the issue a bit, too. (Not to mention, I found citations suggesting a different
kind of increase than the one I used in the ribbing swatches.) I’ll evaluate
each swatch as I go, but it’s likely that I’ll reknit all of them except for
the seed swatch.</p>

<h2 id="so-are-you-like-okay">So are you like… okay?</h2>

<p>This is actually fine! I’m more excited about this than I have been all week
working on the citations and answers and formatting and editing down my blocking
paper (oh GOD), because this is what I wanted to get out of the program: I want
my knitting to get better, even the tiny details that most knitters are too
polite to notice. And it actually doesn’t come out to all that much work I need
to do over; the citations for each swatch are still good, and in all honesty,
18 4x4 swatches is just not that much knitting. I ordered new yarn (because no
way in hell am I frogging, resetting, and drying all those little baby skeins)
and I’ll set out on redoing the swatches today; hopefully I won’t finish too
soon before my KnitPicks order shows up.</p>

<p>And I have plenty of time. Before this setback, I thought that I’d be done with
the packet and pop it in the mail by the end of next week. Y’all, I’m not going
back to work until <em>Christmas</em>. We’ve got time.</p>

<p>So, here I go, grinning once again into the knitting breach.</p>]]></content><author><name></name></author><category term="leave" /><category term="knitting" /><summary type="html"><![CDATA[The Master Hand Knitting Level 1 application involves, among other things, 18 swatches demonstrating good execution of a handful of techniques. I knitted these 18 swatches back in 2022, when I was much more optimistic (blind?) about the quality of my knitting. Sure, I thought, it looks a little like this “rowing out” thing on the edges, but it’s not that bad and the evaluators won’t notice!]]></summary></entry><entry><title type="html">Restarting the Master Hand Knitter Level 1 Application</title><link href="/leave/knitting/2024/10/28/master-knitter-lv1.html" rel="alternate" type="text/html" title="Restarting the Master Hand Knitter Level 1 Application" /><published>2024-10-28T00:00:00+00:00</published><updated>2024-10-28T00:00:00+00:00</updated><id>/leave/knitting/2024/10/28/master-knitter-lv1</id><content type="html" xml:base="/leave/knitting/2024/10/28/master-knitter-lv1.html"><![CDATA[<p>For more info about the Master Hand Knitter program, see the
<a href="https://tkga.org/certification/master-hand-knitting/">TKGA website</a>.</p>

<p>For those who can use Ravelry and have accounts, you can see my progress on my
<a href="https://www.ravelry.com/projects/nasamuffin/tkga-master-hand-level-1">project page</a>.</p>

<p>I’ll work through the list below over the next couple of weeks. Maybe I can
get it in the mail before I leave for Vermont :)</p>

<p>A catalogue of the things I need to do before I can mail my MHK Lv1 binder out:</p>

<ol>
  <li>Note updated instruction date on cover page</li>
  <li>Double-check that the swatches are packed correctly (email and ask)</li>
  <li>Check swatches for any damage (bugs)</li>
  <li>Check prior answers in the worksheets</li>
  <li>Finish the worksheets/comparison table</li>
  <li>Make the mitten!</li>
  <li>Block the mitten!</li>
  <li>Photograph the mitten &amp; post on Ravelry</li>
  <li>Do the mitten worksheet</li>
  <li>Check that the website references aren’t broken</li>
  <li>Print cover letter</li>
  <li>Print instruction cover page (with date)</li>
  <li>Double-check Ravelry photo documentation</li>
  <li>Double-check checklist on page 3 of instructions</li>
  <li>Write the paragraph for the stitch gauge worksheet. (4 references - 2 on
analyzing gauge, 2 on measuring gauge)</li>
</ol>

<p>Changes the swatch portfolio:</p>

<h2 id="preliminary-swatch">Preliminary Swatch</h2>
<ul>
  <li>Redo the swatch and include the pre-blocked gauge sheet too.</li>
  <li>Use the larger needle range to include US9.</li>
  <li>Redo answers to the worksheet</li>
</ul>

<h2 id="swatch-1">Swatch 1</h2>
<ul>
  <li>Find reference for increasing evenly in ribbing</li>
  <li>Reprint swatch sheet</li>
</ul>

<h2 id="swatch-2">Swatch 2</h2>
<ul>
  <li>Redo it, to do the pre-blocking question.</li>
</ul>

<h2 id="swatch-6">Swatch 6</h2>
<ul>
  <li>Get 4 references instead - 2 each for right and left lifted.</li>
</ul>

<h2 id="all-increase-and-decrease-swatches">All increase and decrease swatches</h2>
<ul>
  <li>Reread the “guide for another knitter” and see if it makes sense.</li>
</ul>

<h2 id="swatch-11">Swatch 11</h2>
<ul>
  <li>Does it still need a reference for the yarnover? (Mail and ask)</li>
</ul>

<h2 id="swatch-13">Swatch 13</h2>
<ul>
  <li>Add references for yarnover types</li>
</ul>

<h2 id="swatch-16">Swatch 16</h2>
<ul>
  <li>Double check against template</li>
</ul>

<h2 id="swatch-18">Swatch 18</h2>

<p>Separate references for Figure 8 join (2) and mattress stitch (2)</p>]]></content><author><name></name></author><category term="leave" /><category term="knitting" /><summary type="html"><![CDATA[For more info about the Master Hand Knitter program, see the TKGA website.]]></summary></entry><entry><title type="html">Taking a Break</title><link href="/leave/2024/10/23/taking-a-break.html" rel="alternate" type="text/html" title="Taking a Break" /><published>2024-10-23T00:00:00+00:00</published><updated>2024-10-23T00:00:00+00:00</updated><id>/leave/2024/10/23/taking-a-break</id><content type="html" xml:base="/leave/2024/10/23/taking-a-break.html"><![CDATA[<p>Tap tap. Is this thing on?</p>

<p>I’m taking a <a href="https://lore.kernel.org/git/CAJoAoZnovapqMcu72DGR40jRRqRn57uJVTJg82kZ_rohtGDSfQ@mail.gmail.com/">break from work</a>
for the next two months. (Well, almost the next two months - I still have to
work through 2024-10-25.) During this time, I’ll be (maybe?) blogging more
on this page, assuming I get the apparently critical dep vulnerabilities
fixed.</p>

<h2 id="why">Why?</h2>

<p>A few reasons. None of them are awful - I’m not full-time taking care of my
health (mostly) or a loved one’s; I’m not being asked to take a break for some
horrible thing I did at work; I’m not seriously contemplating an exit from
Google, where I somehow still get to work on things I love all day.</p>

<p>Mostly, I’m just taking a break because I want to.</p>

<p>Burnout is very common among software developers. I don’t think mine is overly
severe, but it’s definitely there: I wake up tired most days, I have to scrape
together the energy to finish working later than 4pm. For the last few years,
as a lead, I primarily work on things that move really, really slowly, because
they’re huge. That’s great, but it definitely leads to a feeling of sameness.</p>

<p>There are also some things in my life that I really want to focus more on, and
I’m always too tired to find the time. Like playing with my dog, getting better
at my hobbies, getting to know the community around me, keeping my household
smooth and stress-free. Once upon a time, Google offered a sabbatical program
for employees with a certain length of tenure. This doesn’t exist anymore, but
after 8 years (!!) at Google, I’m ready for an extended break.</p>

<p>November and December is, honestly, a great time to do it. Nobody gives a shit
in Q4 anyways. Work goes slowly; people are taking vacation. Autumn is the best
time for walks and bike rides. I can travel on the train, cold enough that it
feels festive, but before threat of winter storms and 18 hour delays. (That
happened to me once!) With apologies to my family, I can see them in November,
then skip the entire rodeo that is Christmastime travel - instead, I can spend
Christmas at home, in peace, snuggled up with my dogs.</p>

<h2 id="what-do-you-even-do-with-nothing-to-do-for-two-months">What do you even do, with nothing to do for two months?</h2>

<p>This part is easy! I’m not one of these people who insists they could never
retire because they have nothing to do. I, frankly, cannot wait to be able
to retire (current unpaid break notwithstanding). I collect hobbies like
they’re going out of fashion. Like many who benefit from ADHD, I don’t always
see these hobbies through to the end, but that’s not always because I get
bored of them. Sometimes it’s just because I run out of time.</p>

<p>I’ve got a few big goals, a few smaller goals, and a few scheduled plans.</p>

<h3 id="big-goal-1-submit-the-master-hand-knitter-level-1-packet">Big Goal #1: Submit the Master Hand Knitter Level 1 Packet</h3>

<p>Some folks may know that in 2022 I became incredibly interested in becoming
certified as a <a href="https://tkga.org/certification/master-hand-knitting/">Master Hand Knitter</a>.
In fact, I did great focusing on it for the first few months. I finished about
90% of the packet, completed all the knitting samples, things were great. But
I hit a snag (a small one!) and that was enough to derail me.</p>

<p>My first priority is to finish this packet and mail it out. I got my hands on
the updated version of the packet this week; next Monday I’ll go through the
updated prompt, see what I have done or still need to do, and make a task list
to wrap it up. Then I expect I’ll spend most of my days at the library or at
my desk at home, knitting and writing and researching.</p>

<p>When I have my project plan figured out, I’m hoping I will remember to post
it to this blog for accountability, and in case anybody cares.</p>

<h3 id="scheduled-thing-artisan-bread-course-at-king-arthur-in-vt">Scheduled Thing: Artisan Bread Course at King Arthur in VT</h3>

<p>In early November (so, maybe even while I’m still working on the MHK packet)
I’ll be taking the Amtrak across the country - longer than I have ridden it so
far! - and have enrolled me and my mother in a baking course. It’s at the King
Arthur headquarters in Vermont, and so I’ll be in relatively-rural New England
at the height of the leaves. I am… very excited.</p>

<p>I’ve taken the Amtrak many times before, but this will be the furthest. The
itinerary is as follows:</p>

<ul>
  <li>Capital Corridor from Santa Clara, CA to Emeryville, CA</li>
  <li>California Zephyr from Emeryville, CA to Chicago, IL</li>
  <li>Lake Shore Limited from Chicago, IL to Sprinfield, MA</li>
</ul>

<p>It’s not quite all the way coast-to-coast, but Massachusetts kind of counts,
right? The California Zephyr is usually about 40 hours (two nights), and the
LSL is another overnight, although we leave pretty late at night and arrive
in the late morning or afternoon or something. As long as I don’t hit a severe
delay, I’ve got a pretty long layover in Chicago, where maybe I’ll get to
visit a friend’s new yarn store, or maybe I’ll just eat food and shop
irresponsibly in the Loop. Who can say.</p>

<p>I’ll post about the train trip, of course, and hopefully I’ll post about the
baking class too. I’m planning on bringing my new Canon R100 and macro lens,
so hopefully I can get some lovely baked good pictures while I’m there.</p>

<h3 id="big-goal-2-project-planning-my-campervan">Big Goal #2: Project Planning My Campervan</h3>

<p>Some <em>also</em> may know that I own a 1966 Ford Econoline (baby blue) and was once
devoting a lot of time to outfitting it to serve as a camper van. This, too,
hit a fairly minor snag and derailed my entire planning (thanks, ADHD) except
this time it’s also been all wrapped up with guilt, too. I want to revive this
project, or at very least get rid of the guilt, so the plan for the camper is
something like this:</p>

<ul>
  <li>Decide whether to continue with the project, or sell the van</li>
  <li>Figure out the insurance, registration, and garaging situation, which is
currently causing all the stress</li>
  <li>Price out options for engine swap - fuel-injected gas, or even better, EV</li>
  <li>Figure out how or whether to ship it for such an engine swap</li>
  <li>Chart out other work that still needs to happen to the interior</li>
  <li>Find options for body work to restore the exterior (and fix a leak)</li>
</ul>

<p>This takes second place to the MHK stuff because I care about it a little bit
less, but also because even if I can get only part of this list done, I will
still feel better than I did before, which I think will lower my general
burnout and anxiety floor.</p>

<p>When I do start planning these things out, I hope to be blogging about it quite
a lot, again to keep myself accountable.</p>

<h3 id="scheduled-thing-blacksmithing-taster-class-at-the-crucible">Scheduled Thing: Blacksmithing Taster Class at the Crucible</h3>

<p>This is a small one, but as a sort-of-anniversary-gift (six years next week) I
registered my partner and I for a short, introductory blacksmithing course in
Oakland. I’m really looking forward to it - and sort of hoping I don’t love it
too much. “This had better not awaken anything in me,” as they say.</p>

<h3 id="small-stuff">Small Stuff</h3>

<p>Most of my other goals revolve around having a healthier relationship with my
home and hobbies. So, in no particular order:</p>

<ul>
  <li>Get back in the habit of walking out with Crash in the mornings</li>
  <li>Finish my to-be-read pile (currently around 6 books, but I read the books
and the pile never seems to get smaller)</li>
  <li>Deep-clean the house what needs it (my office, the espresso machine,
probably the garage)</li>
  <li>Finish some videogames - The Witness, maybe Death Stranding, maybe P3R</li>
  <li>Stop using Arch btw and put vanilla Debian on my home desktop</li>
  <li>Fuck around with Jellyfin on the dance game rig (it can do both!)</li>
  <li>Cook a lot more exciting things</li>
  <li>Take a lot more lovely knitting photos</li>
  <li>Bike everywhere, Caltrain everywhere, BART everywhere</li>
  <li>Sleep more than 7 hours most nights (is such a thing even possible?)</li>
  <li>Avoid getting re-addicted to caffeine :(</li>
</ul>

<p>I dunno. Lots of things.</p>

<h2 id="ok-cool">ok cool</h2>

<p>This blog has an RSS feed link, and I already started sharing it with people at
work who are interested in what I’ll be up to, so I’m gonna try and keep it
updated.</p>

<p>I meant for this post to be some whole introspective thing about how burnout
sucks and everyone should take more breaks, and that’s true, but instead I
ended up talking about what I’ll post here later on. Hopefully that’s true too.</p>

<p>See folks next time(?)</p>]]></content><author><name></name></author><category term="leave" /><summary type="html"><![CDATA[Tap tap. Is this thing on?]]></summary></entry><entry><title type="html">A Tour of Git’s Object Types</title><link href="/git/open-source/version-control/scm/2019/06/06/git-objects-explained.html" rel="alternate" type="text/html" title="A Tour of Git’s Object Types" /><published>2019-06-06T00:00:00+00:00</published><updated>2019-06-06T00:00:00+00:00</updated><id>/git/open-source/version-control/scm/2019/06/06/git-objects-explained</id><content type="html" xml:base="/git/open-source/version-control/scm/2019/06/06/git-objects-explained.html"><![CDATA[<p>Naming is one of the hard problems in computer science, right? It’s hard for
Git developers too. One of the more arcane concepts in Git - object
reachability - becomes simpler to understand with a little bit of naming
indirection.</p>

<p>Reachability is an important concept in Git. It’s how the server determines
what objects you need in order to get it up to what the server itself knows.
It’s also how merges and rebases work. With all this big stuff riding on
reachability, it seems intimidating to try to understand - but it turns out if
we give it a slightly simpler name, things become a little clearer.</p>

<h2 id="gits-four-object-types">Git’s four object types</h2>

<p>Under the covers, Git is mostly a directed graph of objects. Those objects come
in four flavors; from root to leaf (generally), those flavors are:</p>

<ul>
  <li>Tag</li>
  <li>Commit</li>
  <li>Tree</li>
  <li>Blob</li>
</ul>

<p>We’ll take a closer look in the opposite order, though.</p>

<h1 id="blob">Blob</h1>

<p>Surprise! It’s a file. Well, kind of - it can also be a symlink to a file - but
this is the most atomic type of object. We’ll explore these a little more later,
but really, it’s just a file.</p>

<h1 id="tree">Tree</h1>

<p>A tree references zero or more trees or blobs. Said another way, a tree holds
one or more trees or files. This sounds familiar - basically, a tree is a
directory. (Okay, or a symlink to a directory.) It points to more trees
(subdirectories) or blobs (files). It can also point to commits in the case
of submodules, but that’s another conversation.</p>

<p>By the way, “tree” is one that gets a little sticky, because we also talk about
“working tree” as well as “worktree”. We’ll touch back on that in a minute.</p>

<h1 id="commit">Commit</h1>

<p>This is the one we’re all familiar with - commits are those things we write at
1am, angry at a pesky bug, and label with something like “really fix it this
time”, right?</p>

<p>A commit references exactly one tree. That’s the root directory of your project.
It also references zero or more other commits - and this is where we diverge
from the filesystem parallel, because the other commits it references are its
parent(s), each of which has its own copy of the project at that commit’s point
in time. (Commits with more than one parent are merge commits; otherwise, your
commit only has the one parent.)</p>

<p>Commits represent a specific state of the repository which someone thought was
worth saving - a new feature, or a small step of progress which you don’t want
to lose as you’re hacking your way through that homework assignment. Each commit
points to a complete image of the repository - but that’s not as bad as it
sounds, as we’ll see when we try it out.</p>

<h1 id="tag">Tag</h1>

<p>Tags are a little lackluster after all the exciting types up until now. They are
essentially a label; they serve as an entry point into the graph and point to
either another tag or a commit. They’re generally used to mark releases, and you
can see them pretty easily with <code class="language-plaintext highlighter-rouge">git log --oneline --decorate=full</code>.</p>

<h1 id="a-quick-return-to-an-overloaded-word">A quick return to an overloaded word</h1>

<p>“Tree”, “worktree”, and “working tree” seem to refer to different concepts. A
tree is a folder. Your working tree is your project state (and we can talk about
having a “clean” working tree, which means you don’t have any staged or unstaged
changes pending). And “worktree” is a way for you to work on multiple branches
simultaneously in a different directory in a safe way (read <code class="language-plaintext highlighter-rouge">git help worktree</code>
for more - worktrees are awesome). But they’re all named tree!</p>

<p>It’s a little clearer now that we know that every commit points to one tree -
the root of the project, a.k.a. your working tree, a.k.a. your worktree. <code class="language-plaintext highlighter-rouge">git
worktree</code> lets you put the tree associated with the commit at the tip of your
current branch in a different directory than the one you cloned into, and
having a clean working tree means that your filesystem is the same as the tree
your <code class="language-plaintext highlighter-rouge">HEAD</code> points to.</p>

<h2 id="try-it-and-seetm">Try It And See<sup>TM</sup></h2>

<p>It turns out the details of what objects Git knows about and what those objects
contain isn’t as opaque as we might think. Git exposes a number of “plumbing
commands” which aren’t so handy for interactive use but which are very useful
for scripting, as they describe the state of the repository in a concise and
predictable way. Let’s walk through creating a pretty basic repository and
examining it with some low-level plumbing commands!</p>

<h1 id="an-empty-repo">An empty repo</h1>

<p>For starters, we’ll make a new, shiny, totally empty repo.</p>

<figure class="highlight"><pre><code class="language-shell_session" data-lang="shell_session"><span class="gp">$</span><span class="w"> </span><span class="nb">mkdir </span>demo
<span class="gp">$</span><span class="w"> </span><span class="nb">cd </span>demo
<span class="gp">$</span><span class="w"> </span>git init</code></pre></figure>

<p>We’ve got nothing. If we try <code class="language-plaintext highlighter-rouge">git log</code>, we’ll be assured that we have no
commits, and if we try <code class="language-plaintext highlighter-rouge">git branch -a</code> we’ll see we have no branches, either.
So let’s make a very simple first commit.</p>

<h1 id="a-single-commit">A single commit</h1>

<figure class="highlight"><pre><code class="language-shell_session" data-lang="shell_session"><span class="gp">$</span><span class="w"> </span><span class="nb">echo</span> <span class="s2">"abcd"</span> <span class="o">&gt;</span>foo.txt
<span class="gp">$</span><span class="w"> </span>git add foo.txt
<span class="gp">$</span><span class="w"> </span>git commit <span class="nt">-m</span> <span class="s2">"first commit"</span></code></pre></figure>

<p>I know this is boring, but bear with me and run <code class="language-plaintext highlighter-rouge">git ls-tree HEAD</code>.</p>

<p>Hey, look, a blob! You’ll see the object mode, the type, the <em>object ID</em>, and
the name of the file. For the rest of the post, I’ll refer to the object ID as
the OID.</p>

<p>The OID is a hash of the file contents. You can verify this for yourself with
<code class="language-plaintext highlighter-rouge">git hash-object foo.txt</code> - it’s the same as your new blob’s OID. The new blob
is literally just your file foo.txt, which you can verify by running <code class="language-plaintext highlighter-rouge">git
cat-file -p &lt;oid&gt;</code>:</p>

<figure class="highlight"><pre><code class="language-shell_session" data-lang="shell_session"><span class="gp">$</span><span class="w"> </span>git ls-tree HEAD
<span class="go">100644 blob acbe86c7c89586e0912a0a851bacf309c595c308	foo.txt
</span><span class="gp">$</span><span class="w"> </span>git cat-file <span class="nt">-p</span> acbe86c7c89586e0912a0a851bacf309c595c308
<span class="go">abcd</span></code></pre></figure>

<p>While we’re here, we can also take a look at the commit object. Use <code class="language-plaintext highlighter-rouge">git log</code>
to determine your commit’s OID, then use <code class="language-plaintext highlighter-rouge">git cat-file -p</code> to print the
contents:</p>

<figure class="highlight"><pre><code class="language-shell_session" data-lang="shell_session"><span class="gp">$</span><span class="w"> </span>git log
<span class="gp">commit a491754d3256b5823607d7ea4afb835c07f9fc2c (HEAD -&gt;</span><span class="w"> </span>master<span class="o">)</span>
<span class="gp">Author: Emily Shaffer &lt;nasamuffin@gmail.com&gt;</span><span class="w">
</span><span class="go">Date:   Wed Jun 5 22:56:25 2019 -0700

    first commit
</span><span class="gp">$</span><span class="w"> </span>git cat-file <span class="nt">-p</span> a491754d3256b5823607d7ea4afb835c07f9fc2c
<span class="go">tree 7376230624de9a38f4ea6ca4c41d47e41304b1bd
</span><span class="gp">author Emily Shaffer &lt;nasamuffin@gmail.com&gt;</span><span class="w"> </span>1559800585 <span class="nt">-0700</span>
<span class="gp">committer Emily Shaffer &lt;nasamuffin@gmail.com&gt;</span><span class="w"> </span>1559800585 <span class="nt">-0700</span>
<span class="go">
first commit</span></code></pre></figure>

<p>This gave us the OID of our root tree, which we can also examine:</p>

<figure class="highlight"><pre><code class="language-shell_session" data-lang="shell_session"><span class="gp">emily@xenaTWP:~/demo$</span><span class="w"> </span>git cat-file <span class="nt">-p</span> 7376230624de9a38f4ea6ca4c41d47e41304b1bd
<span class="go">100644 blob acbe86c7c89586e0912a0a851bacf309c595c308	foo.txt</span></code></pre></figure>

<p>And what do you know - it’s precisely the same output as <code class="language-plaintext highlighter-rouge">git ls-tree HEAD</code>.
Because we are literally printing the tree pointed to by HEAD.</p>

<h1 id="a-new-file">A new file</h1>

<p>Let’s see what happens when we add another file.</p>

<figure class="highlight"><pre><code class="language-shell_session" data-lang="shell_session"><span class="gp">$</span><span class="w"> </span><span class="nb">echo</span> <span class="s2">"efgh"</span> <span class="o">&gt;</span>bar.txt
<span class="gp">$</span><span class="w"> </span>git add bar.txt
<span class="gp">$</span><span class="w"> </span>git commit <span class="nt">-m</span> <span class="s2">"The noise you make after too much time at the bar."</span>
<span class="go">[master acc255b] The noise you make after too much time at the bar.
 1 file changed, 1 insertion(+)
 create mode 100644 bar.txt</span></code></pre></figure>

<p>Now we’ll take a look at <code class="language-plaintext highlighter-rouge">git ls-tree HEAD</code> again and compare it to the output
from the prior commit (if you’ve scrolled past, you can run <code class="language-plaintext highlighter-rouge">git ls-tree
HEAD^</code>).</p>

<figure class="highlight"><pre><code class="language-shell_session" data-lang="shell_session"><span class="gp">$</span><span class="w"> </span>git ls-tree HEAD^
<span class="go">100644 blob acbe86c7c89586e0912a0a851bacf309c595c308	foo.txt
</span><span class="gp">$</span><span class="w"> </span>git ls-tree HEAD
<span class="go">100644 blob ac38e5aa3826c56e2f32df05d23d2c27f09e7782	bar.txt
100644 blob acbe86c7c89586e0912a0a851bacf309c595c308	foo.txt</span></code></pre></figure>

<p>It looks like we didn’t actually create a new blob for foo.txt. That’s why this
concept of each commit containing a copy of every file in the repository is
actually okay - the only new objects of substance being created are new copies
of whatever thing you’ve changed. (This is also why it’s historically a bad idea
to check in your compiled binaries - someone doing <code class="language-plaintext highlighter-rouge">git clone</code> with no arguments
will get not just your latest release binary, but every release binary you ever
checked in. Oof.)</p>

<p>But wait - if we shouldn’t check in our 50MB release build, why is it okay for
us to check in our 5000-line legacy monolithic class? (Don’t be embarrassed. It
happens to all of us.) It turns out that I’m not being totally honest when I say
we store “a copy of every file”. All the objects are stored in <code class="language-plaintext highlighter-rouge">.git/objects/</code>,
so we can have a look with <code class="language-plaintext highlighter-rouge">cat
.git/objects/ac/be86c7c89586e0912a0a851bacf309c595c308</code>. Breathe a sigh of
relief; blobs are stored in a compressed state and <code class="language-plaintext highlighter-rouge">git cat-file</code> unpacks it for
us. The issue here is that your binary is much more difficult to compress than
a text file.</p>

<h1 id="a-modified-file">A modified file</h1>

<p>So what happens when we modify a file?</p>

<figure class="highlight"><pre><code class="language-shell_session" data-lang="shell_session"><span class="gp">$</span><span class="w"> </span><span class="nb">echo</span> <span class="s2">"aaaa"</span> <span class="o">&gt;</span>foo.txt
<span class="gp">$</span><span class="w"> </span>git add foo.txt
<span class="gp">$</span><span class="w"> </span>git commit <span class="nt">-m</span> <span class="s2">"the scream of despair"</span>
<span class="gp">$</span><span class="w"> </span>git ls-tree HEAD
<span class="go">100644 blob ac38e5aa3826c56e2f32df05d23d2c27f09e7782	bar.txt
100644 blob 5d308e1d060b0c387d452cf4747f89ecb9935851	foo.txt</span></code></pre></figure>

<p>Looks like our bar.txt object remains, but we’ve got a new OID for foo.txt. So
what exactly lives in the blob of a file modification?</p>

<figure class="highlight"><pre><code class="language-shell_session" data-lang="shell_session"><span class="gp">$</span><span class="w"> </span>git cat-file <span class="nt">-p</span> 5d308e1d060b0c387d452cf4747f89ecb9935851
<span class="go">aaaa</span></code></pre></figure>

<p>No diff. It’s the whole file. And our old version isn’t gone; we can still pull
out the OID we used to know about:</p>

<figure class="highlight"><pre><code class="language-shell_session" data-lang="shell_session"><span class="gp">$</span><span class="w"> </span>git cat-file <span class="nt">-p</span> acbe86c7c89586e0912a0a851bacf309c595c308
<span class="go">abcd</span></code></pre></figure>

<h1 id="a-subdirectory">A subdirectory</h1>

<p>We mentioned earlier that trees can point to trees. Let’s put it into practice:</p>

<figure class="highlight"><pre><code class="language-shell_session" data-lang="shell_session"><span class="gp">$</span><span class="w"> </span>mdkir baz
<span class="gp">$</span><span class="w"> </span><span class="nb">echo </span>frotz <span class="o">&gt;</span>baz/zork.txt
<span class="gp">$</span><span class="w"> </span>git add baz
<span class="gp">$</span><span class="w"> </span>git commit <span class="nt">-m</span> <span class="s2">"ran out of placeholder words"</span></code></pre></figure>

<p>So we expect to see a new tree and a new blob. A first crack at <code class="language-plaintext highlighter-rouge">git ls-tree
HEAD</code> doesn’t go so well:</p>

<figure class="highlight"><pre><code class="language-shell_session" data-lang="shell_session"><span class="gp">$</span><span class="w"> </span>git ls-tree HEAD
<span class="go">100644 blob ac38e5aa3826c56e2f32df05d23d2c27f09e7782	bar.txt
040000 tree 22741c26d13c9539d0ab7476ce09074dbd62a977	baz
100644 blob 5d308e1d060b0c387d452cf4747f89ecb9935851	foo.txt</span></code></pre></figure>

<p>What happened to <code class="language-plaintext highlighter-rouge">zork.txt</code>? It’s still there:</p>

<figure class="highlight"><pre><code class="language-shell_session" data-lang="shell_session"><span class="gp">$</span><span class="w"> </span>git ls-tree 22741c26d13c9539d0ab7476ce09074dbd62a977
<span class="go">100644 blob 8e4020bb5a8d8c873b25de15933e75cc0fc275df	zork.txt</span></code></pre></figure>

<p>By default, <code class="language-plaintext highlighter-rouge">git ls-tree</code> kind of behaves like <code class="language-plaintext highlighter-rouge">ls</code> - it doesn’t recurse into
the trees it finds.  So we’ll ask it to recurse (<code class="language-plaintext highlighter-rouge">-r</code>) and to also show the
names of tags it’s recursing into (<code class="language-plaintext highlighter-rouge">-t</code>):</p>

<figure class="highlight"><pre><code class="language-shell_session" data-lang="shell_session"><span class="gp">$</span><span class="w"> </span>git ls-tree <span class="nt">-rt</span> HEAD
<span class="go">100644 blob ac38e5aa3826c56e2f32df05d23d2c27f09e7782	bar.txt
040000 tree 22741c26d13c9539d0ab7476ce09074dbd62a977	baz
100644 blob 8e4020bb5a8d8c873b25de15933e75cc0fc275df	baz/zork.txt
100644 blob 5d308e1d060b0c387d452cf4747f89ecb9935851	foo.txt</span></code></pre></figure>

<h1 id="summary">Summary</h1>

<p>In the end, we have four commits:</p>

<figure class="highlight"><pre><code class="language-shell_session" data-lang="shell_session"><span class="gp">$</span><span class="w"> </span>git log <span class="nt">--oneline</span>
<span class="gp">230a4e9 (HEAD -&gt;</span><span class="w"> </span>master<span class="o">)</span> ran out of placeholder words
<span class="go">a0aa5e4 the scream of despair
acc255b The noise you make after too much time at the bar.
a491754 first commit</span></code></pre></figure>

<p>Each one has its own tree:</p>

<figure class="highlight"><pre><code class="language-shell_session" data-lang="shell_session"><span class="gp">$</span><span class="w"> </span>git ls-tree 230a4e9
<span class="go">100644 blob ac38e5aa3826c56e2f32df05d23d2c27f09e7782	bar.txt
040000 tree 22741c26d13c9539d0ab7476ce09074dbd62a977	baz
100644 blob 5d308e1d060b0c387d452cf4747f89ecb9935851	foo.txt
</span><span class="gp">$</span><span class="w"> </span>git ls-tree a0aa5e4
<span class="go">100644 blob ac38e5aa3826c56e2f32df05d23d2c27f09e7782	bar.txt
100644 blob 5d308e1d060b0c387d452cf4747f89ecb9935851	foo.txt
</span><span class="gp">$</span><span class="w"> </span>git ls-tree acc255b
<span class="go">100644 blob ac38e5aa3826c56e2f32df05d23d2c27f09e7782	bar.txt
100644 blob acbe86c7c89586e0912a0a851bacf309c595c308	foo.txt
</span><span class="gp">$</span><span class="w"> </span>git ls-tree a491754
<span class="go">100644 blob acbe86c7c89586e0912a0a851bacf309c595c308	foo.txt</span></code></pre></figure>

<p>And in total, we should have <strong>4</strong> blob objects (two versions of <code class="language-plaintext highlighter-rouge">foo.txt</code> and
one version each of <code class="language-plaintext highlighter-rouge">bar.txt</code> and <code class="language-plaintext highlighter-rouge">zork.txt</code>), referenced by <strong>5</strong> tree objects
(one tree per commit, plus one tree for <code class="language-plaintext highlighter-rouge">baz/</code>), which are tracked through time
by <strong>4</strong> commits, giving us a total of 13 objects.</p>

<p>We can check:</p>

<figure class="highlight"><pre><code class="language-shell_session" data-lang="shell_session"><span class="gp">$</span><span class="w"> </span>git rev-list <span class="nt">--all</span> <span class="nt">--objects</span>
<span class="go">230a4e968f007b822d780c70e2f145f5b46ed170
a0aa5e491bb62906dc746aa10c548566e5dc8e4c
acc255b3a1ba1a3471133ff3aa7c2630437dd38c
a491754d3256b5823607d7ea4afb835c07f9fc2c
f2e243fb4052f01287a1d2225a231f9131af6840 
ac38e5aa3826c56e2f32df05d23d2c27f09e7782 bar.txt
22741c26d13c9539d0ab7476ce09074dbd62a977 baz
8e4020bb5a8d8c873b25de15933e75cc0fc275df baz/zork.txt
5d308e1d060b0c387d452cf4747f89ecb9935851 foo.txt
5a684389c10291eb7a187d37c5fb5e6ae6e44b3a 
076c36567233c1e9c22becf6008a96af7f6e865d 
acbe86c7c89586e0912a0a851bacf309c595c308 foo.txt
7376230624de9a38f4ea6ca4c41d47e41304b1bd 
</span><span class="gp">$</span><span class="w"> </span>git rev-list <span class="nt">--all</span> <span class="nt">--objects</span> | <span class="nb">wc</span> <span class="nt">-l</span>
<span class="go">13</span></code></pre></figure>

<p>We can prove it to ourselves a little more easily with some pretty formatting:</p>

<figure class="highlight"><pre><code class="language-shell_session" data-lang="shell_session"><span class="gp">$</span><span class="w"> </span>git rev-list <span class="nt">--all</span> <span class="nt">--objects</span> <span class="nt">--header</span>
<span class="go">230a4e968f007b822d780c70e2f145f5b46ed170
tree f2e243fb4052f01287a1d2225a231f9131af6840
parent a0aa5e491bb62906dc746aa10c548566e5dc8e4c
</span><span class="gp">author Emily Shaffer &lt;nasamuffin@gmail.com&gt;</span><span class="w"> </span>1559803688 <span class="nt">-0700</span>
<span class="gp">committer Emily Shaffer &lt;nasamuffin@gmail.com&gt;</span><span class="w"> </span>1559803688 <span class="nt">-0700</span>
<span class="go">
    ran out of placeholder words
a0aa5e491bb62906dc746aa10c548566e5dc8e4c
tree 5a684389c10291eb7a187d37c5fb5e6ae6e44b3a
parent acc255b3a1ba1a3471133ff3aa7c2630437dd38c
</span><span class="gp">author Emily Shaffer &lt;nasamuffin@gmail.com&gt;</span><span class="w"> </span>1559802687 <span class="nt">-0700</span>
<span class="gp">committer Emily Shaffer &lt;nasamuffin@gmail.com&gt;</span><span class="w"> </span>1559802687 <span class="nt">-0700</span>
<span class="go">
    the scream of despair
acc255b3a1ba1a3471133ff3aa7c2630437dd38c
tree 076c36567233c1e9c22becf6008a96af7f6e865d
parent a491754d3256b5823607d7ea4afb835c07f9fc2c
</span><span class="gp">author Emily Shaffer &lt;nasamuffin@gmail.com&gt;</span><span class="w"> </span>1559801779 <span class="nt">-0700</span>
<span class="gp">committer Emily Shaffer &lt;nasamuffin@gmail.com&gt;</span><span class="w"> </span>1559801779 <span class="nt">-0700</span>
<span class="go">
    The noise you make after too much time at the bar.
a491754d3256b5823607d7ea4afb835c07f9fc2c
tree 7376230624de9a38f4ea6ca4c41d47e41304b1bd
</span><span class="gp">author Emily Shaffer &lt;nasamuffin@gmail.com&gt;</span><span class="w"> </span>1559800585 <span class="nt">-0700</span>
<span class="gp">committer Emily Shaffer &lt;nasamuffin@gmail.com&gt;</span><span class="w"> </span>1559800585 <span class="nt">-0700</span>
<span class="go">
    first commit
f2e243fb4052f01287a1d2225a231f9131af6840 
ac38e5aa3826c56e2f32df05d23d2c27f09e7782 bar.txt
22741c26d13c9539d0ab7476ce09074dbd62a977 baz
8e4020bb5a8d8c873b25de15933e75cc0fc275df baz/zork.txt
5d308e1d060b0c387d452cf4747f89ecb9935851 foo.txt
5a684389c10291eb7a187d37c5fb5e6ae6e44b3a 
076c36567233c1e9c22becf6008a96af7f6e865d 
acbe86c7c89586e0912a0a851bacf309c595c308 foo.txt
7376230624de9a38f4ea6ca4c41d47e41304b1bd </span></code></pre></figure>

<h2 id="back-to-reachability">Back to reachability</h2>

<p>We’re usually worried about finding out which objects are accessible from which
other objects. It turns out that “reachability” can be described in a couple
ways. Most succinctly, we can say it means that an object can be reached from
another object during a revision walk. But we can also describe it by explaining
what reachability means for each type of object.</p>

<ul>
  <li>
    <p>Tag A is reachable from tag B if tag B can eventually be dereferenced to tag
A. Tags can be thought of as pointers, so if <code class="language-plaintext highlighter-rouge">*b==a</code> or <code class="language-plaintext highlighter-rouge">***b==a</code> or so on is
true, then tag A is reachable by tag B.</p>
  </li>
  <li>
    <p>Commit A is reachable from commit B if commit A is an ancestor of commit B.
For commits, “reachability” is synonymous with “ancestry”.</p>
  </li>
  <li>
    <p>Tree A is reachable from tree B if it is a subdirectory of the directory tree
B is talking about. That is, if <code class="language-plaintext highlighter-rouge">find b-dir -name a-dir -type d</code> would succeed.</p>
  </li>
  <li>
    <p>Blobs don’t point to other blobs. But blob A is reachable from tree B if blob
A is contained within the directory of tree B - that is, if <code class="language-plaintext highlighter-rouge">find b-dir -name
a-file -type f</code> would succeed.</p>
  </li>
  <li>
    <p>Tree A is reachable from commit B if it’s commit B’s root tree, or if it’s a
subdirectory of that root tree.</p>
  </li>
  <li>
    <p>Commit A is reachable from tag B if tag B can eventually be dereferenced to a
tag which points directly to commit A, since tags can point to other tags or to
commits.</p>
  </li>
</ul>

<p>So while it means something a little different for each object, it’s ultimately
trying to answer the question: “Somewhere in my history, did I know about this
object?”</p>]]></content><author><name></name></author><category term="git" /><category term="open-source" /><category term="version-control" /><category term="scm" /><summary type="html"><![CDATA[Naming is one of the hard problems in computer science, right? It’s hard for Git developers too. One of the more arcane concepts in Git - object reachability - becomes simpler to understand with a little bit of naming indirection.]]></summary></entry><entry><title type="html">How I Learned to Love the Email Patch Developer Workflow</title><link href="/git/open-source/email/code-review/2019/05/22/how-i-learned-to-love-email-patches.html" rel="alternate" type="text/html" title="How I Learned to Love the Email Patch Developer Workflow" /><published>2019-05-22T07:51:50+00:00</published><updated>2019-05-22T07:51:50+00:00</updated><id>/git/open-source/email/code-review/2019/05/22/how-i-learned-to-love-email-patches</id><content type="html" xml:base="/git/open-source/email/code-review/2019/05/22/how-i-learned-to-love-email-patches.html"><![CDATA[<p><em>Note: This post is adapted in part from my guide to contributing to the Git
project, which you can read
<a href="https://github.com/git/git/blob/master/Documentation/MyFirstContribution.txt">here</a>.
I owe my thanks to my reviewers there, including Junio C. Hamano, Johannes
Schindelin, Jonathan Tan, Josh Steadmon, and Phil Hord.</em></p>

<p>Five weeks ago, I joined a new team at Google, and began contributing to a new
project: <a href="https://git-scm.org">Git</a>. I was (and still am) thrilled to be
working on a piece of software used by countless developers across the globe!
To gain a deep knowledge of a tool I’ve evangelized for so long!</p>

<p>But then I subscribed to the mailing list, and it truly began to sink in to me
that for the forseeable future, I could expect my mailbox to look something like
this:</p>

<p><img src="/assets/how-i-learned-to-love-email-patches/patches-inbox.png" alt="An inbox overflowing with patches." /></p>

<p>Ouch.</p>

<h2 id="out-of-my-element">Out of My Element</h2>

<p>When I started writing code professionally, I worked on a team that used Gerrit.
I liked it well enough that I continued to recommend it when asked; an iterative
review UI based on Git, who could ask for more? At my next company, code reviews
were performed by another developer examining your ClearCase checkout and
sending you an email about it (yikes). Later I was asked to evaluate Team
Foundation Server’s built-in review tooling for another company, on a team which
insisted that “code reviews take valuable developer time” - and, as a result,
generally didn’t perform them. Then I was lucky to fall back into a team using
Git alongside a proprietary review tool, and then, back to my roots: Git and
Gerrit on <a href="https://openbmc.org">OpenBMC</a>, and Gerrit for our internal fork, too.</p>

<p>This whole time, I figured no matter how bad the review process was, at least it
wasn’t emailed patches. Why does anybody still use that terrible workflow? Who
would want to review a diff line-by-line in their email client?!</p>

<p>I was envisioning someone painstakingly copying a diff from an email body and
pasting it into <code class="language-plaintext highlighter-rouge">apply</code>. Or carefully making a second copy of the altered file
and running <code class="language-plaintext highlighter-rouge">diff -u</code>, and then handwriting the subject and commit message.</p>

<p>Of course, nobody does that. It’s absolutely true that no developer today - let
alone the bash-happy Unix devs of yesteryear - would use that workflow. With
some tooling and good practices, I found a workflow that I love - and found
myself arguing in defense of emailed patches!</p>

<h2 id="git-format-patch-to-the-rescue"><code class="language-plaintext highlighter-rouge">git format-patch</code> to the Rescue</h2>

<p>Perhaps unsurprisingly, since the Git project itself is organized via emailed
patches, Git has some excellent built-in tooling for preparing your commits for
the inbox. <code class="language-plaintext highlighter-rouge">git format-patch</code> is the most notable - with it you can prepare an
entire branch for mailing, include a cover letter, indicate a Request for
Comment change, generate updated v2 or later patches, and more.</p>

<p>It’s easiest to use <code class="language-plaintext highlighter-rouge">git format-patch</code> if you’ve been working in a feature
branch (which you always do, right..?) - for the purposes of the tutorial, we’ll
assume the main branch of the project is <code class="language-plaintext highlighter-rouge">master</code> and your feature branch is
<code class="language-plaintext highlighter-rouge">feature</code>; we’ll also assume that <code class="language-plaintext highlighter-rouge">feature</code> has been recently rebased onto the
tip of <code class="language-plaintext highlighter-rouge">master</code>.</p>

<h1 id="preparing-a-single-patch">Preparing a Single Patch</h1>

<p>Imagine that you’ve got only one commit in your feature branch. Typically
projects like to see individual patches sent as a single email with no cover,
with a subject like “[PATCH] component: my great feature”. Make sure that your
working tree is clean - that is, everything you want committed is committed -
and run the following.</p>

<figure class="highlight"><pre><code class="language-shell_session" data-lang="shell_session"><span class="gp">$</span><span class="w"> </span>git format-patch <span class="nt">-o</span> feature-patches/ master..feature</code></pre></figure>

<p>That’s it! <code class="language-plaintext highlighter-rouge">-o feature-patches/</code> tells Git that you want your patchfile in the
<code class="language-plaintext highlighter-rouge">feature-patches/</code> directory, and <code class="language-plaintext highlighter-rouge">master..feature</code> tells Git you want patches
for the diff between <code class="language-plaintext highlighter-rouge">master</code> and <code class="language-plaintext highlighter-rouge">feature</code> - which in this case should be only
one commit.</p>

<p>Now take a look in <code class="language-plaintext highlighter-rouge">feature-patches/</code>. You should see a single file named
something like <code class="language-plaintext highlighter-rouge">0001-component-my-great-feature.patch</code>. If you open it up in
your favorite editor (I like Vim), you’ll see an email header, your commit
message, a diffspec, and a unified diff indicating your changes.</p>

<p>Ideally, your commit message should say everything there is to be said about
your patch. But sometimes, there’s some context you want to add that isn’t
appropriate for a commit message - for example, maybe you want to warn everyone
that you won’t be addressing comments until next week as you’re visiting your
aunt in Mallorca and she doesn’t like to give out her wifi password. In that
case, look for the <code class="language-plaintext highlighter-rouge">---</code> above the diffspec - you can provide your additional
message there. It will look something like this:</p>

<figure class="highlight"><pre><code class="language-email" data-lang="email"><span class="nt">From 1345bbb3f7ac74abde040c12e737204689a72723 Mon Sep 17 00</span><span class="o">:</span><span class="na">00:00 2001</span>
<span class="nt">From</span><span class="o">:</span><span class="na"> Dev Eloper &lt;developer@cool.website&gt;</span>
<span class="nt">Date</span><span class="o">:</span><span class="na"> Thu, 18 Apr 2019 15:11:02 -0700</span>
<span class="nt">Subject</span><span class="o">:</span><span class="na"> [PATCH] README: change the grammar</span>

I think it looks better this way. This part of the commit message will
end up in the commit-log.

Signed-off-by: Dev Eloper &lt;developer@cool.website&gt;
---
I welcome everyone's comments on this change, however, I will be unable
to answer until next Friday. My aunt still insists that if she gives me
her wifi password I will hack the Pentagon from her cottage.

 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 88f126184c..38da593a60 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
 Git - fast, scalable, distributed revision control system
 =========================================================

-Git is a fast, scalable, distributed revision control system with an
+Git is a fast, scalable, and distributed revision control system with an
 unusually rich command set that provides both high-level operations
 and full access to internals.

--
2.21.0.392.gf8f6787159e-goog</code></pre></figure>

<p>Great. You can see in the example which parts of the email will be retained as
a commit message, and which parts will be ignored by <code class="language-plaintext highlighter-rouge">git am</code>. If you’re not
sure how it will look, you can always try running it through <code class="language-plaintext highlighter-rouge">git am</code> yourself
to have a look at the resulting commit.</p>

<p><em>If your organization likes even single-commit changes to contain a cover letter
you can just use the instructions in the next section.</em></p>

<h1 id="preparing-a-patch-series-with-cover-letter">Preparing a Patch Series with Cover Letter</h1>

<p>If you’ve been working on a much larger feature and your branch has a number of
commits, you can still use <code class="language-plaintext highlighter-rouge">git format-patch</code> pretty easily. Like before, make
sure your working tree is clean and your commits are all in order, then run</p>

<figure class="highlight"><pre><code class="language-shell_session" data-lang="shell_session"><span class="gp">$</span><span class="w"> </span>git format-patch <span class="nt">--cover-letter</span> <span class="nt">-o</span> feature-patches/ master..feature</code></pre></figure>

<p>Have a look in <code class="language-plaintext highlighter-rouge">feature-patches/</code>. You should see n+1 patch files (where n is
the number of commits you have on top of master). Most of them will reflect the
subject lines of your patches, but there will be one named beginning with
0000 - that’s your cover letter. Go ahead and open it in your favorite editor.</p>

<p>You should see that it’s already got a template, including some email headers
and a diffstat. Change the subject line to something that summarizes your entire
feature, taking care to preserve the “[PATCH 0/X]” portion. You can also include
context in the body of the cover letter to explain anything about the patchset
which wasn’t appropriate for inclusion into the commit messages. For a larger
changeset, this is typically the place where you explain what your feature is
<em>as a whole</em>.</p>

<p>If you examine the other patches, you will see that they are all marked
In-Reply-To the Message-Id of your cover letter. This is good and what most
communities prefer, but you can change the behavior with the <code class="language-plaintext highlighter-rouge">--thread</code>
argument.</p>

<h1 id="some-tips-for-format-patch">Some Tips for Format-Patch</h1>

<ul>
  <li>Resist the urge to edit the diff in the patch directly. The diff contains some
line number information that needs to match up and is hard to fudge by hand.
Plus, your local tree will get out-of-sync with what you’re sending upstream.</li>
  <li>The timestamp at the top of the patch is special and indicates that the patch
was generated with <code class="language-plaintext highlighter-rouge">git format-patch</code>; don’t touch it.</li>
  <li>The build number at the bottom indicates which version of Git you used to
generate the patch; you can delete this if you are feeling the need for
privacy.</li>
  <li>The area below the <code class="language-plaintext highlighter-rouge">---</code> or the cover letter in v2 or later patches is a great
spot for you to explain what changed between the previous version and this
one. Your reviewer could use an interdiff to figure it out, but it’s kind to
give them a hint.</li>
</ul>

<h2 id="show-them-what-you-got-git-send-email">Show Them What You Got: <code class="language-plaintext highlighter-rouge">git send-email</code></h2>

<p><em>Note: One thing this tutorial won’t cover is how to download and configure
<code class="language-plaintext highlighter-rouge">git send-email</code>. Not because it’s hard, or trivial, but because setup steps
vary quite a bit depending on your system and email client. <code class="language-plaintext highlighter-rouge">send-email</code> is
often not packaged with base Git; you may have to install it separately. This
tutorial assumes you’ve already got it up and running.</em></p>

<p>After the steps in the previous section, you should have one or more patch
files in your <code class="language-plaintext highlighter-rouge">feature-patches/</code> directory, and you should also have examined
your patches to ensure that they look perfect and ready for review. Sending them
is as simple as this:</p>

<figure class="highlight"><pre><code class="language-shell_session" data-lang="shell_session"><span class="gp">$</span><span class="w"> </span>git send-email <span class="nt">--to</span><span class="o">=</span>mailing-list@project.org feature-patches/<span class="k">*</span>.patch</code></pre></figure>

<p>That’s it! Your patches are out and your reviews should come pouring in. (Okay,
maybe “trickling” is a better word.)</p>

<h2 id="responding-to-comments">Responding to Comments</h2>

<p><em>Note: As with Gerrit and other iterative code review tools based around a Git
workflow, making your changes involves using interactive rebase. I won’t cover
that here, as it’s not significantly different from other processes, and it’s
complex enough to take its own tutorial.</em></p>

<p>Your reviewers will likely provide their comments inline, and it’s often good
manners to reply to each review comment indicating whether you’ve taken an
action or not. When I’m replying to review comments, I like to have a window
open with a reply to the email, and another window open with my code. I make
sure that I’ve begun an interactive rebase and paused to edit the commit I’m
examining comments for, and then I open my source file. As I read comments in
the email, I make a change as appropriate in my source, then type a response
inline to the comment in question. (That way I know I didn’t miss anything!)</p>

<p>When you’ve addressed all the comments for a certain patch, make sure to <code class="language-plaintext highlighter-rouge">git
add -u &amp;&amp; git commit --amend</code> to update your commit with the changes. Once
you’ve updated your entire branch this way, you’re ready to send v2.</p>

<figure class="highlight"><pre><code class="language-shell_session" data-lang="shell_session"><span class="gp">$</span><span class="w"> </span>git format-patch <span class="nt">--v2</span> <span class="nt">-o</span> feature-patches/ <span class="o">[</span><span class="nt">--cover-letter</span><span class="o">]</span></code></pre></figure>

<p>(You should include <code class="language-plaintext highlighter-rouge">--cover-letter</code> if you’re sending more than one patch. For
a single patch, you should omit it.)</p>

<p>Take a look in <code class="language-plaintext highlighter-rouge">feature-patches/</code>. You should see a new set of patches next to
the old ones, this time preceding with <code class="language-plaintext highlighter-rouge">v2-</code>. Edit the cover letter or patch
body to include details on the changes since v1.</p>

<p>As long as you’ve got In-Reply-To: set up correctly on your single patch or
cover letter, you can send almost just like before; just make sure to target
the v2 patches:</p>

<figure class="highlight"><pre><code class="language-shell_session" data-lang="shell_session"><span class="gp">$</span><span class="w"> </span>git send-email <span class="nt">--to</span><span class="o">=</span>mailing-list@project.org feature-patches/v2<span class="k">*</span>.patch</code></pre></figure>

<h2 id="a-happy-emailed-patch-developer">A Happy Emailed-Patch Developer</h2>

<p>There you have it! Emailed patches aren’t so bad with the help of a couple
handy Git tools. While they’re a little bit more effort than a push to Gerrit,
I’d argue that the time spent editing the cover letter is about equitable to
the time spent writing the message associated with the review in a graphical
tool. Plus, the ability to perform reviews via email means you can get <em>really</em>
wild and set up something like <code class="language-plaintext highlighter-rouge">mutt</code> so you can both review code and respond
to reviews of your own code within your favorite editor - and is there anything
that isn’t made more fun by the addition of Vim keybindings?</p>

<p>Happy hacking!</p>]]></content><author><name></name></author><category term="git" /><category term="open-source" /><category term="email" /><category term="code-review" /><summary type="html"><![CDATA[Note: This post is adapted in part from my guide to contributing to the Git project, which you can read here. I owe my thanks to my reviewers there, including Junio C. Hamano, Johannes Schindelin, Jonathan Tan, Josh Steadmon, and Phil Hord.]]></summary></entry><entry><title type="html">Read-Writable Regular Expressions</title><link href="/regex/documentation/2019/05/08/documenting-regex.html" rel="alternate" type="text/html" title="Read-Writable Regular Expressions" /><published>2019-05-08T04:21:45+00:00</published><updated>2019-05-08T04:21:45+00:00</updated><id>/regex/documentation/2019/05/08/documenting-regex</id><content type="html" xml:base="/regex/documentation/2019/05/08/documenting-regex.html"><![CDATA[<p>Regex is great, right? It’s concise, it’s precise, and the process of developing
an expression that works just right is a hell of a lot of fun. Until you submit
a patch to your coworkers with your beautiful expression, and they leave you
comments like,</p>

<ul>
  <li>“How does this regex work?”</li>
  <li>“What does this even do?”</li>
  <li>“Is this busproof? Nobody else on the team knows regex!”</li>
</ul>

<p>It’s probably not a good idea to encourage your coworkers to think critically
about what life would be like if you got hit by a bus, but the good news is that
you can simultaneously document your regular expression and teach your coworkers
some regex basics, if you comment them carefully!</p>

<p>For the purposes of this post, we’ll use pseudocode and extended regular
expressions (<code class="language-plaintext highlighter-rouge">grep -e</code> or <code class="language-plaintext highlighter-rouge">egrep</code>).</p>

<h1 id="a-source-of-frustration">A source of frustration</h1>

<p>Sometime in your life, you’ve probably seen a code review that looks something
like this:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># Capture the friendly text only.
matches = match("\[(.*?)\]\(https?://[a-zA-Z./?=-_]+\)")
friendly = matches[1]
</code></pre></div></div>

<p>When you see code like this, either you wrote it, or you have no idea what it
does (inclusive). Even if you know how it works today, by the time you get back
from your meeting after lunch, you will probably have forgotten and need to
reexamine the expression. And if that’s how you feel as the regex wizard, how do
you think your team feels?</p>

<h1 id="how-can-we-do-better">How can we do better?</h1>

<p>Lucky for us, regular expressions are already pretty well divided. A good rule
of thumb is to document each atom individually. For example:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># Capture the friendly text only.
matches = match(
    "\["                # The opening brace on the friendly text
    "(.*?)"             # The contents of the friendly text
    "\]"                # The closing brace on the friendly text
    "\(http"            # The opening brace and beginning of URL
    "s?"                # HTTPS optional
    "://"               # Continue the URL
    "[a-zA-Z./?=-_]+"   # The variable part of the URL
    "\)"                # The closing brace of the target URL
)
friendly = matches[1]
</code></pre></div></div>

<p>This is better. At least your reviewers can see what you’re trying to do. But
why does your friendly text need to end in <code class="language-plaintext highlighter-rouge">?</code>? Are you only highlighting links
which are questions? Is this some heavily-indirected FAQ?</p>

<p>You may be thinking, “I know regex! I know that means I’m doing a lazy match!
Come on!” But who among us hasn’t gone back for a quick Google when we
accidentally match the entire HTML page while just trying to match a single tag?
(Side note:
<a href="https://stackoverflow.com/a/1732454">do not use regex to parse HTML</a>.)</p>

<p>So while documenting each atom is a good start, it’s a good idea to document any
particularly dark magic you may invoke, including (but not limited to):</p>

<ul>
  <li>Character class shorthands (<code class="language-plaintext highlighter-rouge">\s</code>)</li>
  <li>Capture groups (<code class="language-plaintext highlighter-rouge">foo(.*)</code>)</li>
  <li>Backreferences (<code class="language-plaintext highlighter-rouge">(\w+) \1ovich</code>)</li>
  <li>Lookaround (<code class="language-plaintext highlighter-rouge">(?=[a-f0-9]+).{8}</code>)</li>
  <li>Greedy, lazy, possessive quantifiers (<code class="language-plaintext highlighter-rouge">&lt;\w+?&gt;</code>)</li>
  <li>Literal characters which usually have special meaning (<code class="language-plaintext highlighter-rouge">\[[a-z]+\]</code>)</li>
  <li>Bounded repeat quantifiers (<code class="language-plaintext highlighter-rouge">\w{8,36}</code>)</li>
</ul>

<p>Let’s try again.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># Capture the friendly text only.
matches = match(
    "\["                # The opening brace on the friendly text (literal [)
    "(.*?)"             # The contents of the friendly text - capture group 1,
                            # lazy match to avoid capturing the next link too
    "\]"                # The closing brace on the friendly text (literal ])
    "\(http"            # The opening brace and beginning of URL (literal ()
    "s?"                # HTTPS optional
    "://"               # Continue the URL
    "[a-zA-Z./?=-_]+"   # The variable part of the URL (alpha plus URL symbols)
    "\)"                # The closing brace of the target URL (literal ))
)
# Friendly text in capture group 1
friendly = matches[1]
</code></pre></div></div>

<p>That’s much nicer, right? And hey, your senior colleague just came by your desk
to mention that for the last decade she has been using <code class="language-plaintext highlighter-rouge">([^)]*)</code> because she
didn’t know about lazy matching, and she learned something new today. Even
seasoned developers don’t know every way there is to use regex, and commenting
your expressions explicitly and verbosely will teach your team members things
they had never even thought to look up.</p>

<p>We’re almost there. Finally, you want your coworkers to have some idea of what
sort of string they should write in order to match your expression. An example
string can play double duty as sort of section markers for your expression,
showing which part of the target string is matched by which part of the regex.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># Capture the friendly text from Markup hyperlinks.
# [Friendly text](https://target-website.com)
matches = match(
    # [Friendly text]
    "\["                # The opening brace on the friendly text (literal [)
    "(.*?)"             # The contents of the friendly text - capture group 1,
                            # lazy match to avoid capturing the next link too
    "\]"                # The closing brace on the friendly text (literal ])
    # (https://target-website.com)
    "\(http"            # The opening brace and beginning of URL (literal ()
    "s?"                # HTTPS optional
    "://"               # Continue the URL
    "[a-zA-Z./?=-_]+"   # The variable part of the URL (alpha plus URL symbols)
    "\)"                # The closing brace of the target URL (literal ))
)
# Friendly text in capture group 1
friendly = matches[1]
</code></pre></div></div>

<p>This is awesome! Let’s go over some highlights.</p>

<ul>
  <li>Your coworkers can point out easier ways to do something that you’ve done in
your expression (e.g. using a shorthand character class for your URL)</li>
  <li>Your coworkers can learn ways to use regex that they didn’t know about before
(e.g. lazy matching)</li>
  <li>Your coworkers can tell easily if your regex makes a bad assumption (e.g. are
you sure you got the
<a href="https://twitter.com/gregmcintyre/status/1123720996404584449">bracket order right</a>?)</li>
  <li>If someone needs to update part of the regex, they know exactly where to look.</li>
  <li>If someone doesn’t understand why their string isn’t matching, they know
pretty much what their string should look like.</li>
</ul>

<p>Never let anybody tell you that regices are write-only!</p>]]></content><author><name></name></author><category term="regex" /><category term="documentation" /><summary type="html"><![CDATA[Regex is great, right? It’s concise, it’s precise, and the process of developing an expression that works just right is a hell of a lot of fun. Until you submit a patch to your coworkers with your beautiful expression, and they leave you comments like,]]></summary></entry></feed>