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

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: What's obstructing me?
To:
Christian Weisgerber <naddy@mips.inka.de>
Cc:
gameoftrees@openbsd.org
Date:
Thu, 1 Oct 2020 23:13:40 +0200

Download raw body.

Thread
On Thu, Oct 01, 2020 at 10:44:07PM +0200, Christian Weisgerber wrote:
> I tried stsp's GOT_TEST_ROOT diff...
> 
> $ got st          
> M  README
> M  regress/cmdline/Makefile
> M  regress/cmdline/common.sh
> M  regress/cmdline/import.sh
> 
> ... and now I want to clean it out again:
> 
> $ got revert -R .              
> got: /home/naddy/got/README: file is obstructed
> 
> *scratches head*
> Is that expected or a bug?

It's a bug which I believe was fixed by commit
aa9ad2764a70adc7378ea2b701d08f9dd7c8dd7d

You have a corrupt file index entry which was written by some version
of Got from before the above commit, and this corruption has been
copied along ever since.

Older versions of Got wrote uninitialized data to the file type field.
There is a bit which was unused in older versions of Got and nowadays
represents file type 'symlink'. From got revert's point of view, this
hypothetical symlink is obstructed by a regular file on disk, and Got
refuses to delete an apparently unversioned regular file in order to
make space for a versioned symlink. It doesn't realize that file index
meta data is telling a lie.

You can fix this problem by recreating the file index.
I documented the necessary steps in got-worktree(5):

     A corrupt or missing file index can be recreated on demand as follows:

	   $ mv .got/file-index .got/file-index.bad
	   $ got update # re-create .got/file-index
	   $ find. -type f -exec touch {}\; # update timestamp of all files
	   $ got update # sync timestamps

After running these commands, your work tree should behave as expected again.