"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:
Fri, 24 Feb 2023 21:19:15 +0100

Download raw body.

Thread
Stefan Sperling:

> 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:

So the problem is much easier to reproduce than I expected.
Here is a basic test:

diff /home/naddy/got
commit - 1eb5d2a086f570f5bd47339ea2f7e477d9503422
path + /home/naddy/got
blob - c40836b609cfeffeedd9916e00ee56432e887ee5
file + regress/cmdline/update.sh
--- regress/cmdline/update.sh
+++ regress/cmdline/update.sh
@@ -636,6 +636,30 @@ test_update_merges_file_edits() {
 	test_done "$testroot" "0"
 }
 
+test_update_changes_file_to_dir() {
+	local testroot=`test_init update_changes_file_to_dir`
+
+	got checkout $testroot/repo $testroot/wt > /dev/null
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		test_done "$testroot" "$ret"
+		return 1
+	fi
+
+	git_rm $testroot/repo alpha
+	mkdir $testroot/repo/alpha
+	echo eta > $testroot/repo/alpha/eta
+	(cd $testroot/repo && git add alpha/eta)
+	git_commit $testroot/repo -m "changed alpha into directory"
+
+	(cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr)
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		ret="xfail change file into directory"
+	fi
+	test_done "$testroot" "$ret"
+}
+
 test_update_merges_file_edits() {
 	local testroot=`test_init update_merges_file_edits`
 
@@ -3088,6 +3112,7 @@ run_test test_update_merges_file_edits
 run_test test_update_creates_missing_parent
 run_test test_update_creates_missing_parent_with_subdir
 run_test test_update_file_in_subsubdir
+run_test test_update_changes_file_to_dir
 run_test test_update_merges_file_edits
 run_test test_update_keeps_xbit
 run_test test_update_clears_xbit

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