Grafting NetBSD history onto OpenBSD

· text

mkdir(1) has been around for a long time. While reading the history of its source code, I ran into Theoʼs initial import of NetBSD (commit df930be708d). Since OpenBSD and NetBSD both provide Git mirrors of their repositories, I wondered if I could graft NetBSDʼs old history onto the tail end of OpenBSDʼs history.

As best I can tell, Theoʼs initial import corresponds closely to NetBSDʼs commit e3cc76915a7. That commit added French messages to distrib/sets/lists/base/mi. Theoʼs first commit has that change but not any subsequent ones.

With a plausible common-ancestor in hand, I modified my OpenBSD repository so that it can use my NetBSD repository as an alternate object store. I did that by adding the line


to my OpenBSD repoʼs .git/objects/info/alternates. To convince myself that the alternate is working, I ran git show e3cc76915a7 in my OpenBSD repository and the NetBSD commit appeared.

The last step was to persuade Git that Theoʼs import commit had that NetBSD commit as its parent. This did the trick:

git replace --graft df930be708d e3cc76915a7

Now, when I git log -- bin/mkdir/mkdir.c I see the history of mkdir all the way back to when NetBSD imported from 386bsd-0.1. It works with git blame too.