* * * * *

                             The shaving of yaks

A day ago, a month ago (time no longer has real meaning anymore), I was ask
to look into moving our code away from SVN (Subversion) [1] and into git [2].
Ever since I've been pretty much busy with the shaving of yaks [3]—lots and
lots of yaks.

And it's more than just converting a repository of code from SVN to git—it's
also breaking up what is basically a monorepos [4] into lots of separate
repos for reasons (operations hates having to checkout the 800 pound gorilla
for the 4 oz. banana). And without losing history if at all possible.

Lots of yaks to shave in this project.

So I've been learning about submodules in git and while I like git, I'm not a
fan of the submodule. First, when you clone a repository with submodules (git
clone https://git.example.com/foo.git) you don't get the submodules. That's
another two steps to get them (git submodule init; git submodule update). I
solved that issue with a new Makefile target:

-----[ Makefile ]-----
getmod:
       git submodule init
       git submodule update
-----[ END OF LINE ]-----

And on the build system, I made sure that make getmod was done prior to make.
That issue solved.

Another issue—we use Lua [5] in our department, but we ended up with using
two different versions. The stuff I built is still using 5.1.5, while a new
project a fellow cow-orker wrote used 5.3.2. This is a chance to consolidate
some dependencies, and to that end, I have a new single Lua repo with every
version of Lua from 5.1.4 to 5.3.5 (with all the patches [6] applied). But as
I found out (and many yaks were shaved to bring me this information) you
can't just checkout a particular tag or branch for a submodule.

Grrrrrr.

So I solved that issue in the Makefile as well:

-----[ Makefile ]-----
VLUA := $(shell cd deps/lua ; git describe --tag)

ifneq ($(VLUA),"5.1.5.p2")
 DUMMY := $(shell cd deps/lua; git checkout 5.1.5.p2)
endif
-----[ END OF LINE ]-----

This checks to see which version of Lua is checked out, and if it's not the
one I want, check out the version I do want. I also had to make sure the
gitmodule file had ignore = all set:

-----[ data ]-----
[submodule "deps/lua"]
       path = deps/lua
       url = https://git.example.com/lua.git
       ignore = all
-----[ END OF LINE ]-----

to prevent git status from freaking people out.

I figure this will keep me busy for the next few months at least. Or maybe
days. Time just flows strangely these days.

[1] https://subversion.apache.org/
[2] https://git-scm.com/
[3] http://catb.org/jargon/html/Y/yak-shaving.html
[4] https://en.wikipedia.org/wiki/Monorepo
[5] https://www.lua.org/
[6] https://www.lua.org/bugs.html

Email author at [email protected]