[PATCH] t7900: use pwd -P in macOS maintenance test
- From
Mark Mentovai <mark@chromium.org>
- Date
- May 23, 2025, 19:37 UTC
- Message-ID
- <20250523193722.68344-1-mark@chromium.org>
$pfx is the basis for the expectation that launchd plist paths formed by `git maintenance start` will be compared against. These paths are formed in `git maintenance` by builtin/gc.c launchctl_service_filename(), which calls path.c interpolate_path() with real_home = 1, causing abspath.c strbuf_realpath() to resolve a canonical absolute path. Since $pfx is not determined according to the same realpath semantics, when t7900 is run from a working directory that contains a symbolic link in its path, the realpath operation will produce a different path than $pfx contains, although both paths logically reference the same directory. The test fails in this case.
Base $pfx on the physical working directory (pwd -P), with all symbolic links fully resolved, so that the path that the test expects matches what `git maintenance` generates, even when running from a working directory whose path contains a symbolic link.
Signed-off-by: Mark Mentovai <mark@chromium.org> --- t/t7900-maintenance.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh index 8cf89e285f49..677e92f1490e 100755 --- a/t/t7900-maintenance.sh +++ b/t/t7900-maintenance.sh @@ -882,7 +882,7 @@ test_expect_success 'stop preserves surrounding schedule' ' test_expect_success 'start and stop macOS maintenance' ' # ensure $HOME can be compared against hook arguments on all platforms - pfx=$(cd "$HOME" && pwd) && + pfx=$(cd "$HOME" && pwd -P) && write_script print-args <<-\EOF && echo $* | sed "s:gui/[0-9][0-9]*:gui/[UID]:" >>args
-- 2.49.0