Experiments using git subtree to manage FreeBSD contrib/

Ed Maste emaste at freebsd.org
Wed Jan 22 14:33:40 UTC 2020

I have been experimenting with git-subtree to manage contrib/ code, as
a git workflow analogue to our current Subversion vendor branch
approach. As described previously on this list[1] and on the git
mailing list [2] there were some oddities in our current svn->git
converted repo. They tripped up "git subtree split" and made the
split-out repo unusable.

Recent proposed git patches have addressed those issues and alllow us
to make progress with experiments. (We're not yet ready to commit to
and document the subtree workflow though.)

Tom Clarkson posted a patch set[3] that allows command-line control of
the subtree split process and avoid the undesired part of the commit
graph. I tried the changes, and the patched subtree split works as
we'd like.

I split elftoolchain using these commands:

% git subtee ignore --clear-cache --prefix=contrib/elftoolchain 4d43158
% git subtee use --prefix=contrib/elftoolchain 9ee78763
% git subtee split --prefix=contrib/elftoolchain upstream/master

This took about 15 minutes to run - more than manageable for what will
be a one-time operation.

The result is available in a branch in my github elftoolchain fork[4].
There are still a few undesired commits (e.g., [5], [6]) to be cleaned
up, and a final conversion would be done with additional --ignores to
eliminate them. That said, they don't impede progress while we're
prototyping. The split-out contrib/elftooclhain subtree is a
reasonably faithful representation over 247 commits of the changes
made in svn.

Next steps with subtree experiments include converting additional
contrib/ directories, and prototyping updates from upstream (with some
that use git, and some that do not). I'm interested in finding other
contrib/ code maintainers who are willing to test out the conversion -
please send me a note if so.

[1] https://lists.freebsd.org/pipermail/freebsd-git/2019-November/000218.html
[2] https://lore.kernel.org/git/CAPyFy2AsmaxU-BDf_teZJE5hiaVpTSZc8fftnuXPb_4-j7j5Fw@mail.gmail.com/
[3] https://github.com/gitgitgadget/git/pull/493
[4] https://github.com/emaste/elftoolchain/tree/tom-clarkson-conversion
[5] https://github.com/emaste/elftoolchain/commit/4c7c3a9c7250934d80336acee52b28216b0e6837
[6] https://github.com/emaste/elftoolchain/commit/a18e967ee8dcb8983de5bfb4e5d6396076abde27

More information about the freebsd-git mailing list