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

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: got: stsp changed refs/heads/main: a92c86451615
To:
Christian Weisgerber <naddy@mips.inka.de>
Cc:
gameoftrees@openbsd.org
Date:
Mon, 11 May 2026 00:03:23 +0200

Download raw body.

Thread
On Sun, May 10, 2026 at 11:35:29PM +0200, Christian Weisgerber wrote:
> ./checkout.sh[1208]: xxd: not found
> 
> That's in test_checkout_bad_tree_entry.  xxd is part of vim and not
> generally available.  Since doing this in a portable way seems to
> be surprisingly difficult[1], maybe another approach is possible?

We could store the bad repository in a bundle and use gotadmin load
to import the data instead of scripting the generation of the bad
repository with xxd.

I have attached the bundle to this message.
The bundle is a binary file so the diff below cannot display it.

 
 store repository test data in a bundle to avoid a dependency on xxd
 
M  regress/cmdline/checkout.sh                     |  5+  21-
A  regress/cmdline/testdata/bad-tree-entry.bundle  |  0+   0-

2 files changed, 5 insertions(+), 21 deletions(-)

commit - e9d5dc61477a542c0a3bc3699883317a5b3b9f99
commit + df998d5428cc63964c7d5024851b8842b1e48ce9
blob - c8ef507ad4c4e2a131df8f23f98bc51701be8f16
blob + cfb6705ed30d29539dccd3c1bd10f3aaa607e224
--- regress/cmdline/checkout.sh
+++ regress/cmdline/checkout.sh
@@ -1125,29 +1125,13 @@ test_checkout_tree_with_dot_got() {
 }
 
 test_checkout_bad_tree_entry() {
-	local testroot=`test_init checkout_bad_tree_entry`
+	local testroot=`test_init checkout_bad_tree_entry 1`
 
-	(
-	cd $testroot/repo
+	gotadmin load -q -r $testroot/repo < ./testdata/bad-tree-entry.bundle
+	local commit_id=d52a061702e571487aaa7419511966945f2a23da
+	git -C $testroot/repo update-ref refs/heads/main "$commit_id"
+	git -C $testroot/repo symbolic-ref HEAD refs/heads/main
 
-	entry() {
-		mode="$1"
-		name="$2"
-		sha="$3"
-		printf '%s %s\0' "$mode" "$name"
-		printf '%s' "$sha" | xxd -r -p
-	}
-
-	blob="$(echo 'oh no' | git hash-object -w --stdin)"
-	tree="$(entry 100644 ../pwned "$blob" | git hash-object -w -t tree --stdin --literally)"
-
-	commit="$(echo cursed | git commit-tree "$tree")"
-	git update-ref refs/heads/main "$commit"
-	git symbolic-ref HEAD refs/heads/main
-	)
-
-	local commit_id=`git_show_head $testroot/repo`
-
 	got checkout $testroot/repo $testroot/wt > $testroot/stdout
 	ret=$?
 	if [ $ret -ne 0 ]; then
blob - /dev/null
blob + c4334a46f766c6415e7c5466f0e07a13752f9c4e (mode 644)
Binary files /dev/null and regress/cmdline/testdata/bad-tree-entry.bundle differ