Repository navigation
Open
Description
TestWorktreeStorageMissingMainPreservesCanonicalIdentity fails on any machine whose global git config sets worktree.useRelativePaths = true. Found on 22 October while rebasing #422: the test fails on main (02f36e9, and also 182157e) on such a machine and passes with GIT_CONFIG_GLOBAL=/dev/null. Run alone or with the other worktree storage tests, it fails every time, so a developer checking worktree behavior gets a false failure. Two full make verify-local runs on the same machine passed it, for a reason not yet understood.
Steps to reproduce
- Set
git config --global worktree.useRelativePaths true. - Run
env -u LOAF_DB go test ./internal/cli -run TestWorktreeStorageMissingMainPreservesCanonicalIdentity -count=1. - The
relative-pointer-truecase fails becausefilepath.Relcannot relate the already-relativegitdirpath to the absolute worktree path. WithGIT_CONFIG_GLOBAL=/dev/nullthe test passes.
Definition of Done
- The test helpers that create Git fixtures run git without reading the developer's global or system config, so the suite gives the same result on every machine.
TestWorktreeStorageMissingMainPreservesCanonicalIdentitypasses withworktree.useRelativePaths = trueset globally and with it unset.- Product behavior is unchanged.
Out of Scope
- Changing how Loaf resolves relative
gitdirpointers; the test's relative case already covers that once its setup works.
Verification
- The test passes with
worktree.useRelativePaths = truein the global config and with it unset. -
go test ./internal/cli -run TestWorktreeStorage -count=1andmake verify-localboth pass on a machine with that setting.
Agent notes
- Start:
gitCLI,initCLIGitRepoandaddCLILinkedWorktreeininternal/cli/cli_test.go, around line 12770. - Find: some tests already isolate git with
GIT_CONFIG_GLOBAL=/dev/nullandGIT_CONFIG_NOSYSTEM=1, for exampleinternal/cli/journal_test.go:470andinternal/cli/enumerated_reader_unix_test.go:170. - Findings: the failing setup is at
internal/cli/worktree_storage_gate_test.go:196. Git 2.56.0 with the setting writes the linked worktree's pointer asgitdir: ../001/.git/worktrees/001-missing-main, sofilepath.Rel(linked, target)fails. It fails when run alone or with-run TestWorktreeStorage, in foreground and background shells with the sameHOME,XDG_CONFIG_HOMEand git config, yet passed in two fullmake verify-localruns that night. No test in the package setsGIT_CONFIG_GLOBALorXDG_CONFIG_HOMEoutsidet.Setenv, so why the full run passes is unexplained.
Metadata
Metadata
Assignees
Labels
No labels
Activity