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

From:
Mikhail Pchelin <misha@freebsd.org>
Subject:
xfail test case for got st scoped to a single .gitignore'd file
To:
gameoftrees@openbsd.org
Date:
Mon, 3 Aug 2026 20:25:48 +0300

Download raw body.

Thread
  • Mikhail Pchelin:

    xfail test case for got st scoped to a single .gitignore'd file

While working on the other patch related to ignore files I came across
inconsistency with git when we do "got st <path to .gitignor'ed file>":

$ got clone ssh://anonymous@got.gameoftrees.org/got.git
$ got checkout -q got.git
$ cd got
$ echo foo > got/.gitignore
$ touch got/foo
$ got st
?  got/.gitignore
$ got st got
?  got/.gitignore

# git doesn't show anything here, 'foo' is in got/.gitignore
$ got st got/foo
?  got/foo

Here is git output:

$ echo foo > got/.gitignore
$ touch got/foo
$ git status --porcelain 
?? got/.gitignore
$ git status --porcelain got
?? got/.gitignore
$ git status --porcelain got/foo
<empty>

# remove .gitignore and check again
$ rm got/.gitignore 
$ git status --porcelain got/foo
?? got/foo

This is a niche case, I haven't researched further.

Xfail test inlined below.

Maybe such behaviour is expected, and we don't want to match git in this?

diff refs/heads/main 50620e32a3e439ce825ba3adf34b5fd8ddaa866a
commit - b3611acb7c736d2f45369e1eea2806450e9d11b2
commit + 50620e32a3e439ce825ba3adf34b5fd8ddaa866a
blob - 0874b88152ef2725e3b0e312b01cda5d76c37b91
blob + e45962c907f9e4a0f5e9775c8b5c50174fd555aa
--- regress/cmdline/status.sh
+++ regress/cmdline/status.sh
@@ -875,6 +875,44 @@ test_status_multiple_gitignore_files() {
 	test_done "$testroot" "$ret"
 }
 
+test_status_gitignore_single_file() {
+	local testroot=`test_init status_gitignore_single_file`
+
+	got checkout $testroot/repo $testroot/wt > /dev/null
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		test_done "$testroot" "$ret"
+		return 1
+	fi
+
+	echo "foo" > $testroot/wt/epsilon/.gitignore
+	echo "unversioned file" > $testroot/wt/epsilon/foo
+
+	# Known bug: 'got status' on the path of a single file:
+	# epsilon/.gitignore will be ignored
+	(cd $testroot/wt && got status epsilon/foo > $testroot/stdout)
+
+	echo -n '' > $testroot/stdout.expected
+	cmp -s $testroot/stdout.expected $testroot/stdout
+	ret=$?
+	if [ $ret -eq 0 ]; then
+		# Bug has been fixed
+		test_done "$testroot" "$ret"
+		return 0
+	fi
+
+	echo '?  epsilon/foo' > $testroot/stdout.expected
+	cmp -s $testroot/stdout.expected $testroot/stdout
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		diff -u $testroot/stdout.expected $testroot/stdout
+		test_done "$testroot" "$ret"
+		return 1
+	fi
+
+	test_done "$testroot" "xfail"
+}
+
 test_status_status_code() {
 	local testroot=`test_init status_status_code`
 
@@ -1247,6 +1285,7 @@ run_test test_status_gitignore_leading_slashes
 run_test test_status_gitignore_trailing_slashes
 run_test test_status_gitignore_comments
 run_test test_status_multiple_gitignore_files
+run_test test_status_gitignore_single_file
 run_test test_status_status_code
 run_test test_status_suppress
 run_test test_status_empty_file