The git version was duplicated from the stable one and the two had
begun to diverge significantly. For example, commit
88d731925d62b162fc7b7b1bc8c75a519a9ac718 fixed a supposedly real
bug — but only in the stable package.
Factor out the shared code to avoid trouble — or worse, subtle
differences or bugs — in future.