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

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: got: allow clone without symrefs
To:
Martijn van Duren <openbsd+got@list.imperialat.at>
Cc:
gameoftrees@openbsd.org
Date:
Sat, 14 Jun 2025 19:24:05 +0200

Download raw body.

Thread
On Sat, Jun 14, 2025 at 06:46:04PM +0200, Martijn van Duren wrote:
> This diff works for me, and should make the default branch logic a
> little more robust. But I'm not sure if the added complexity is worth
> it:
> - If we have a symref keep the logic as is.
> - If we have a "HEAD", try to find a "master" or "main" branch of
>   the same id_str as  "HEAD".
> - If we have a "HEAD", but no id_str matching "master" or "main" branch,
>   default to the first "refs/heads/" branch that matches "HEAD"'s
>   id_str.
> - If there is no "HEAD", try to find "master" or "main" branch of any
>   id_str.
> - Give up and let the user use -b.
> 
> I guess that "master" and "main" are common enough as main branch to
> keep those as fallback, but let's see what sticks :-)

I would prefer to drop all the checks involving "master" or "main"
because those names are not part of the protocol spec. Checking for
those names here looks like a layer violation. It would be an acceptable
heuristic in scripts, but not in protocol implementations.

Otherwise this logic looks fine to me.