Re: got(1) in base consideration

From: Mark Millard <marklmi_at_yahoo.com>
Date: Mon, 05 May 2025 04:01:32 UTC
On May 4, 2025, at 18:50, Kyle Evans <kevans@FreeBSD.org> wrote:

> Hi,

Hello.

> I've been toying around with the idea of pulling got(1) into base, but hidden off into /usr/libexec and not supporting it for general usage. The idea would instead be to provide a script or two as a user-facing interface to do the bare minimum to functionally maintain a local copy of our git repos.
> 
> However, I've run into some logistics issues that I wanted to throw out for some opinions.  The main issue I've run into is that while got's repository layout is binary-compatible with git, it won't setup worktrees the same way.  Additionally, it really doesn't like the traditional organization of a git clone, where you'd have your .git directory inside of your primary worktree (e.g., /usr/src and /usr/src/.git).
> 
> I don't think this is really a deal-breaker, my proposal to start with would be that we clone the repositories off into /var/db/got/$repo or some such and setup the worktrees in the traditional place.  git can `worktree add` from these repos successfully, so one could setup a git-compatible worktree at least without having to re-clone the entire repository, but that brings me to the second caveat noted in the paragraph above: the worktree format isn't compatible.
> 
> We could write a script that'll bridge the gap, but AFAICT that means that we'd effectively have to just blow away the existing got worktree at /usr/src and recreate it, with sensible guardrails in place to try and avoid losing any uncommitted work.  That's sort of ugly and I don't really know how to feel about it, thus this e-mail.
> 
> Thoughts?

I'll note that, as stands, a PkgBase FreeBSD-src-*.snap* and
FreeBSD-src-sys-*.snap* together provide a source tree that
does not contain a git repository. (It used to be true that
the 2 could be from somewhat distinct check outs. I do not
know about now.) No .git/ or .git (plain file) at all.

PkgBase uses /usr/src/ and /usr/src/sys/ and I reserve those
for the PkgBase files in order to best be able to identify
what the installation is based on.

In my context, official PkgBase kernels are present for
booting and the booted world is a PkgBase one based on
main [so: 15]. I've more than this, including places for
chroot use and for poudriere-devel jail use. I also have
my own kernel builds that I can boot instead.

I also use git worktrees:

/usr/official-src/.git/ ( the "main worktree", a normally unmodified stable/* )
/usr/main-src/.git      ( a "linked worktree" for main [so 15 as stands] )
/usr/release-src/.git   ( a "linked worktree", a normally unmodified releng/*.* )

My activity for these is mostly in /usr/main-src/ instead
of in /usr/official-src/ .

I'm not sure what you are intending for contexts based on
PkgBase. (Basically: ignoring my extra stuff.)

===
Mark Millard
marklmi at yahoo.com