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

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

Download raw body.

Thread
On Thu, Aug 13, 2026 at 08:09:07PM +0300, Mikhail Pchelin wrote:
> On Thu, Aug 13, 2026 at 02:16:21PM +0200, Stefan Sperling wrote:
> > The problem is that we call add_ignores_from_parent_paths() with an
> > absolute path where a relative path is expected.
> >
> > The final path argument of this function is expected to be relative to the
> > work tree root path. Passing an absolute path here results in a nonsense
> > path like /path/to/work/tree/path/to/work/tree/epsilon/.gitignore being
> > looked up, instead of /path/to/work/tree/epsilon/.gitignore as it should be.
> >
> > The diff below makes your test pass and does not cause any new test failures.
> > I would like to commit this fix along with your test. Is this fine with you?
> > Can you confirm that this patch fixes the issue for you?

Here is renewed regress patch for convinience.

diff refs/heads/main eec5b817d8f07ea4202dc5b45d6816730aebc7c1
commit - ae25db3f82d89c28505e5fc1f58b8ba693282f5b
commit + eec5b817d8f07ea4202dc5b45d6816730aebc7c1
blob - 0874b88152ef2725e3b0e312b01cda5d76c37b91
blob + 2c46cdbaa6ff453577341907e7adff30b0111a4c
--- regress/cmdline/status.sh
+++ regress/cmdline/status.sh
@@ -875,6 +875,31 @@ 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
+
+	(cd $testroot/wt && got status epsilon/foo > $testroot/stdout)
+
+	echo -n '' > $testroot/stdout.expected
+	cmp -s $testroot/stdout.expected $testroot/stdout
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		diff -u $testroot/stdout.expected $testroot/stdout
+	fi
+
+	test_done "$testroot" "$ret"
+}
+
 test_status_status_code() {
 	local testroot=`test_init status_status_code`
 
@@ -1247,6 +1272,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