From 804aa4fc402848d7006acd7979843a9a9d786c3d Mon Sep 17 00:00:00 2001 From: Tommy Date: Mon, 14 Sep 2026 18:07:05 -0700 Subject: [PATCH] fix(tests): canonicalize the temp repo path in the integration helper cmd_clean --merged uses nested registered worktree path failed on macOS and passed in CI. setup_integration_repo took its path straight from mktemp -d, which on macOS returns /var/folders/... while /var is a symlink to /private/var. git canonicalizes when it registers a worktree, so the hook received /private/var/... and the assertion compared it against the /var/... spelling. Verified this is the test's expectation being wrong rather than a product bug: passing /var/... to `git worktree add` makes git itself register /private/var/..., so the canonical path a hook receives is git's own behavior. Resolving the path in the helper fixes it for every integration test rather than patching the one assertion. Linux is unaffected, since mktemp -d returns /tmp with no symlink to resolve. Full suite now passes locally: 561/561, previously 560/561. --- CHANGELOG.md | 4 ++++ tests/test_helper.bash | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 776d9f8..b90fd6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this ## [Unreleased] +### Fixed + +- The integration test helper now canonicalizes its temporary repository path. On macOS `mktemp -d` returns a `/var` path while git records the resolved `/private/var` one, so `cmd_clean --merged uses nested registered worktree path` compared two spellings of the same directory and failed locally while passing in CI. + ## [2.11.1] - 2026-09-14 ### Changed diff --git a/tests/test_helper.bash b/tests/test_helper.bash index 1a5c2ae..6e4ada1 100644 --- a/tests/test_helper.bash +++ b/tests/test_helper.bash @@ -23,7 +23,9 @@ export -f cfg_default cfg_get_all # Set up a disposable git repo for integration tests # Sets: TEST_REPO, TEST_WORKTREES_DIR setup_integration_repo() { - TEST_REPO=$(mktemp -d) + # Canonicalize: on macOS mktemp -d returns a /var path while git records the + # resolved /private/var one, so uncanonicalized paths never compare equal. + TEST_REPO=$(cd -P "$(mktemp -d)" && pwd) TEST_WORKTREES_DIR="${TEST_REPO}-worktrees" git -C "$TEST_REPO" init --quiet git -C "$TEST_REPO" config user.name "Test User"