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

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: Got is unhappy with the FreeBSD repository
To:
Sebastien Marie <semarie@online.fr>
Cc:
Christian Weisgerber <naddy@mips.inka.de>, gameoftrees@openbsd.org
Date:
Thu, 23 Feb 2023 17:58:05 +0100

Download raw body.

Thread
On Thu, Feb 23, 2023 at 05:24:30PM +0100, Sebastien Marie wrote:
> On Thu, Feb 23, 2023 at 04:58:12PM +0100, Christian Weisgerber wrote:
> > Got chokes when updating to different commits in the FreeBSD
> > repository.
> > 
> > Here's a reproducer:
> > 
> > $ got clone ssh://anongit@git.freebsd.org/src.git
> > $ got co -c 67bceb38f463d8a929c55efdcfcfefc9aedfeff6 src.git
> > $ cd src
> > $ got up
> > [...]
> > U  contrib/llvm-project/libcxx/include/__split_buffer
> > D  contrib/llvm-project/libcxx/include/__sso_allocator
> > U  contrib/llvm-project/libcxx/include/__std_stream
> > U  contrib/llvm-project/libcxx/include/__string
> > got: stat: /home/naddy/tmp/src/contrib/llvm-project/libcxx/include/__string/char_traits.h: Not a directory
> 
> I think I already saw such problem with openbsd for this particular file.
> 
> in fact, .../libcxx/include/__string was a file at some point, and next, it was 
> a directory with files inside it.

Thanks, this is interesting. We should definitely catch this stat error
and try to do something more sensible. In general, we are not yet handling
"tree conflicts" like this in Got, where changes in the file/directory
hierarchy occur in the repository and clash with what is present in
the work tree during an update or merge operation.

Of course, such clashes can and will occur during updates and merges.
The little handling of such cases we have now was added on a best-effort
basis, and there is lot of room for improvements (basic conflict detection
at first, then deal with some simple cases, and eventually try to detect
and auto-resolve tree conflicts involving renamed files; much like similar
work I have done in Subversion over many years).

If someone could add an xfail regression test that triggers this stat
error then I will take a look at improving the behaviour when I find
some spare time. There are already a handful of tests in update.sh which
test behaviour in some tree conflict cases, but the above case (along with
many others) is still missing:
test_update_conflict_wt_add_vs_repo_add
test_update_conflict_wt_edit_vs_repo_rm
test_update_conflict_wt_rm_vs_repo_edit
test_update_conflict_wt_rm_vs_repo_rm