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

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
Re: Got is unhappy with the FreeBSD repository
To:
gameoftrees@openbsd.org
Date:
Sun, 26 Feb 2023 16:37:00 +0100

Download raw body.

Thread
Stefan Sperling:

> Thanks. Please commit it with my OK. I will eventually get around to
> making this behave in a better way. I suppose at the very least
> got update should report an obstructed file rather than erroring out.

It's not just a theoretical concern.  It means that in a worktree
any "got update", including "got update -b <branch>", is blocked
across a file<->directory change.

For instance, I now have a FreeBSD repository where I cannot perform
"got up -b origin/main && got rb main".
(Yes, yes, I could extract myself from this by throwing the worktree
away and using "git" or "got ref" to move "main".  That's not the
point.)

If the replacement happened in two commits, i.e. a removal followed
by a new creation, then you can cross it by updating stepwise from
one commit to the next.  If the replacement happened in a single
commit, which got can't do but git can, then even that is impossible.

Every time I play around with this, I run into new forms of breakage:

$ echo gamma >gamma
$ got add gamma                                        
A  gamma
$ got ci -m 'another new file'
A  gamma
Created commit 9a3d262133b87f62ad3b9917b869fc7e5dafdd18
$ got rm gamma
D  gamma
$ mkdir gamma
$ echo delta >gamma/delta
$ got add gamma/delta                                  
A  gamma/delta
$ got st        # oh, oh
~  gamma
A  gamma/delta
$ got ci
got-read-tree: bad object data
got: bad object data
$ got rv -R .
got-read-tree: bad object data
got: unexpected end of file

Here's another one, where I removed a file "alpha" and then created
"alpha/beta" in its place:

$ got log -sr dummy.git                                      
2023-02-26 main    another new file
2023-02-26 ba3899c create directory in place of old file
2023-02-26 315b701 remove file
2023-02-26 405b133 initial import
$ got co -c 405b133 dummy.git 
A  /home/naddy/tmp/dummy/alpha
Checked out refs/heads/main: 405b133a1e204c4f166f69e074fd69b94acdb18f
Now shut up and hack
$ cd dummy
$ cat alpha 
alpha
$ got up
U  alpha
got: stat: /home/naddy/tmp/dummy/alpha/beta: Not a directory
$ cat -v alpha
100644 beta^@eM-2M-_M-^GM-wM-_:M-nM-^M-pKM-ig^CM-eZM-AM-^\,M-{

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de