From 2d207ed1eccae17ca5ba29920841d0e31c27e3f0 Mon Sep 17 00:00:00 2001 From: Mark Mentovai Date: Wed, 28 May 2025 16:17:37 -0400 Subject: [PATCH 1/2] t: run tests from a normalized working directory Some tests make git perform actions that produce observable pathnames, and have expectations on those paths. Tests run with $HOME set to a $TRASH_DIRECTORY, and with their working directory the same $TRASH_DIRECTORY, although these paths are logically identical, they do not observe the same pathname canonicalization rules and thus might not be represented by strings that compare equal. In particular, no pathname normalization is applied to $TRASH_DIRECTORY or $HOME, while tests change their working directory with `cd -P`, which normalizes the working directory's path by fully resolving symbolic links. t7900's macOS maintenance tests (which are not limited to running on macOS) have an expectation on a path that `git maintenance` forms by using abspath.c strbuf_realpath() to resolve a canonical absolute path based on $HOME. When t7900 runs from a working directory that contains symbolic links in its pathname, $HOME will also contain symbolic links, which `git maintenance` resolves but the test's expectation does not, causing a test failure. Align $TRASH_DIRECTORY and $HOME with the normalized path as used for the working directory by resetting them to match the working directory after it's established by `cd -P`. With all paths in agreement and symbolic links resolved, pathname expectations can be set and met based on string comparison without regard to external environmental factors such as the presence of symbolic links in a path. Suggested-by: Junio C Hamano Signed-off-by: Mark Mentovai Signed-off-by: Junio C Hamano --- t/test-lib.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/t/test-lib.sh b/t/test-lib.sh index 9001ed3a6470a2..e2e91b5b24df90 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -1567,6 +1567,8 @@ fi # Use -P to resolve symlinks in our working directory so that the cwd # in subprocesses like git equals our $PWD (for pathname comparisons). cd -P "$TRASH_DIRECTORY" || BAIL_OUT "cannot cd -P to \"$TRASH_DIRECTORY\"" +TRASH_DIRECTORY=$(pwd) +HOME="$TRASH_DIRECTORY" start_test_output "$0" From 4c0e625c091d4c648cec7319bafaed3cc81658e5 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 9 Jun 2025 07:17:31 -0700 Subject: [PATCH 2/2] Git 2.50-rc2 Signed-off-by: Junio C Hamano --- Documentation/RelNotes/2.50.0.adoc | 5 +++++ GIT-VERSION-GEN | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Documentation/RelNotes/2.50.0.adoc b/Documentation/RelNotes/2.50.0.adoc index c9adfed33999e9..99acf814875246 100644 --- a/Documentation/RelNotes/2.50.0.adoc +++ b/Documentation/RelNotes/2.50.0.adoc @@ -207,6 +207,11 @@ Performance, Internal Implementation, Development Support etc. with platform-natural "int" when we should have used "long", which all have been corrected. + * Tests that compare $HOME and $(pwd), which should be the same + directory unless the tests chdir's around, would fail when the user + enters the test directory via symbolic links, which has been + corrected. + Fixes since v2.49 ----------------- diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 1047b8d11de767..208e91a17f0455 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,6 +1,6 @@ #!/bin/sh -DEF_VER=v2.50.0-rc1 +DEF_VER=v2.50.0-rc2 LF=' '