"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

Mark Jamsek <mark@jamsek.com>
Re: special case 'got fetch -b <branch>' + regress
Game of Trees <gameoftrees@openbsd.org>
Tue, 14 Feb 2023 00:09:07 +1100

Download raw body.

On 23-02-13 12:49PM, Stefan Sperling wrote:
> On Mon, Feb 13, 2023 at 02:23:01AM +1100, Mark Jamsek wrote:
> > At present, we cover 'got fetch' from:
> > 
> >   - repo: got.conf branch that exists on remote (fetches got.conf only)
> >   - repo: -b branch that exists on remote (fetches -b only)
> >   - repo: -b branch that doesn't exist on remote (fetches none)
> >   - repo: got.conf branch that doesn't exist (fallback to remote HEAD)
> >   - wt: got.conf that doesn't exist, wt that does exist (fetches wt only)
> >   - wt: got.conf and wt branches that both exist (fetches conf and wt)
> >   - wt: -b branch that does exist on the remote (fetches -b only)
> >   - wt: -b branch that doesn't exist on the remote (fetches none)
> Thanks! It is nice to see more test coverage added in particular.
> I think you should commit this and we'll keep iterating on top.
> There were ideas about "always fetching HEAD" (specifics pending), which
> this patch does not seem to implement. But we should keep building on top
> of this diff in any case.
> Without good test coverage it would be harder to decide what we really want.


Yes, that was my intent. I'm one of the always-fetch-HEAD proponents,
but I think we need to make some comparisons. So if we can run for a few
days with HEAD fetched only as a fallback, and then try always fetching
HEAD irrespective of whether got.conf or work tree branches are
successfully fetched, we should have a good idea of which mode we

I suspect that the remote's HEAD branch will invariably be set in
got.conf (or git's config) when the repository is cloned; as such, it
will more often than not be fetched in the default configuration.
However, if we move to the always-fetch-HEAD mode, users won't
inadvertently miss it when/if HEAD is changed. So ultimately I think
that will be the better option. OTOH, as we briefly discussed, it might
seem like a misfeature to fetch a branch that the user hasn't requested.

> > As a related change, I'll follow up (tomorrow) with a diff that improves
> > the output when requesting a branch with 'got fetch -b' that does not
> > exist. Currently, we report:
> > 
> >   got-fetch-pack: could not find any branches to fetch
> >   got: could not find any branches to fetch
> Ah, yes, agreed. It would be good to reinstate this change.

Is the man page change ok to commit, too, or would you rather we leave
that till we're settled on the fetch behaviour?

Mark Jamsek <fnc.bsdbox.org|got.bsdbox.org>
GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68