From: Stefan Sperling Subject: Re: xfail test case for got st scoped to a single .gitignore'd file To: Mikhail Pchelin Cc: gameoftrees@openbsd.org Date: Thu, 13 Aug 2026 14:16:21 +0200 On Mon, Aug 03, 2026 at 08:25:48PM +0300, Mikhail Pchelin wrote: > While working on the other patch related to ignore files I came across > inconsistency with git when we do "got st ": > > $ 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 > > > # 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? 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? diff /home/stsp/src/got path + /home/stsp/src/got commit - ae25db3f82d89c28505e5fc1f58b8ba693282f5b blob - fca04b3b62b7ecd7035e827c334fa35ad977b7a3 file + lib/worktree.c --- lib/worktree.c +++ lib/worktree.c @@ -4241,7 +4241,7 @@ worktree_status(struct got_worktree *worktree, const c else { if (!no_ignores) { err = add_ignores_from_parent_paths(&ignores, - worktree->root_path, ondisk_path); + worktree->root_path, path); if (err) goto done; }