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

From:
Omar Polo <op@omarpolo.com>
Subject:
Re: make gotadmin load always read data from stdin
To:
Stefan Sperling <stsp@stsp.name>
Cc:
gameoftrees@openbsd.org
Date:
Mon, 10 Jul 2023 23:20:41 +0200

Download raw body.

Thread
On 2023/07/10 21:28:29 +0200, Stefan Sperling <stsp@stsp.name> wrote:
> This patch makes 'gotadmin load' read bundle streams from stdin only.
> 
> This behaviour has better symmetry with gotadmin dump, and it allows us
> to drop the -b ("branch"?) option and move the reference list to the
> main command line. While here, verify that the names we get on the
> command line are valid reference names.

I didn't like the need to use -b and wondered if it could just get the
refs on the command line but haven't realized that we can just require
the bundle to be fed via stdin.  I really like this change!

> In future I hope would will be able to automatically detect whether
> stdin contains a bundle stream of a fast-import stream (e.g by caching
> the first lines of standard input and checking for a bundle header).

more or less yes, we could.  my plan is to do it without requiring
flags for gotadmin load (but one for gotadmin dump is needed.)  The
minor annoyance is that bundle must start with "# v2 git bundle" (or
v3) and fast-import allows for arbitrary comments starting with "#" so
it could be legal for a fast-import stream to start with the same
signature as a bundle.  Not a big deal however, we'll sort it out
(like peeking at the first character of the second line ;-)

> This way, the usage of gotadmin load would remain the same for both
> case and we would aways load from stdin.
> 
> ok?

ok op@, thanks!

i'm in doubt regarding the -l change, but it's probably for the
better.

> While working on this it occurred to me that the user is currently
> required to list every ref in an absolute fashion, i.e. beginning
> with "refs/" -- maybe we could allow shorter forms as long as they
> are not ambiguous, much like other commands do? Then we could call
> gotadmin load with arguments like this:
>   gotadmin load main origin/main < mybundle
> and these would be expanded to
>   gotadmin load refs/heads/main refs/heads/origin/main < mybundle

agreed on this too.  to be fair when i wrote the second test my first
attempt was with "newbranch" and only then noticed that the full path
is needed.