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

From:
Mark Jamsek <mark@jamsek.com>
Subject:
Re: always fetch remote HEAD except when -b is used
To:
Christian Weisgerber <naddy@mips.inka.de>
Cc:
gameoftrees@openbsd.org
Date:
Wed, 15 Feb 2023 02:35:49 +1100

Download raw body.

Thread
On 23-02-14 04:17PM, Christian Weisgerber wrote:
> Mark Jamsek:
> 
> > As discussed with stsp on irc, this tweaks 'got fetch' again so that the
> > branch resolved via the remote's HEAD ref is not just a fallback--it is
> > always fetched except in the 'got fetch -b branch' case.
> > 
> > This necessitated passing the bflag to got_fetch_pack from cmd_clone(),
> > too, so that we don't fetch HEAD when 'got clone -b branch' is used.
> 
> I'm struggling to make sense of the semantics here.
> 
> $ got clone -b stable/13 ssh://anongit@git.freebsd.org/src.git
> ...
> $ cd src.git
> $ got ref -l | fgrep -v /tags/
> HEAD: refs/heads/stable/13
> refs/heads/stable/13: acaed6b1e2859cb6726e35e8c937b192c16a95c8
> refs/remotes/origin/stable/13: acaed6b1e2859cb6726e35e8c937b192c16a95c8
> $ got fetch
> ...
> $ got ref -l | fgrep -v /tags/
> HEAD: refs/heads/stable/13
> refs/heads/main: 825fbd087e6150eaf601612a5e7468ddc808e004
> refs/heads/stable/13: acaed6b1e2859cb6726e35e8c937b192c16a95c8
> refs/remotes/origin/HEAD: refs/remotes/origin/main
> refs/remotes/origin/main: 825fbd087e6150eaf601612a5e7468ddc808e004
> refs/remotes/origin/stable/13: acaed6b1e2859cb6726e35e8c937b192c16a95c8
> 
> Presumably, if I limit "clone" to a particular branch, that's all
> I'm interested in, and I don't expect the next "fetch" to add the
> remote HEAD branch.

That was my concern with this behaviour: is it a misfeature if we're
ultimately fetching a branch that wasn't requested by the user?

But this is what we've been discussing on irc, and we decided to see how
it goes.

Admittedly, I was one of the proponents of always fetching the remote
HEAD branch, but after sharing my concerns I thought we should first try
only using remote HEAD as a fallback, and then try this
always-fetch-HEAD mode, and figured the feedback will help us decide.
Perhaps the previous incarnation (cf. special case 'got fetch -b
<branch>' to only fetch <branch> [0dd7613ce6]) does indeed make more
sense?

That is, only fallback to fetching the remote's HEAD if there are no
branches set in got.conf and there is no branch to be inferred from
a work tree, or said branches don't exist on the server. And if -b is
passed, we don't fallback to HEAD at all.

I don't feel strongly either way so am more than happy to keep tweaking
this till we get it right.

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