git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t7900: use pwd -P in macOS maintenance test

From
Junio C Hamano <gitster@pobox.com>
Date
May 23, 2025, 21:51 UTC
Message-ID
<xmqq7c27vvv3.fsf@gitster.g>
In-Reply-To
<CAPig+cQLG+zveZg73E=TiC5uShhhRXKmK5Z_M8zN3fpGNEN1ng@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
> Hmm, I'm not sure how that would help this particular case which wants
> to know the path of $HOME:
>
>     pfx=$(cd "$HOME" && pwd -P) &&

We set HOME to TRASH_DIRECTORY during test, so HOME would not be all that special.

I thought one of the issues was on Windows "-P" in "pwd -P" is a no-op? So if you want to fix it locally perhaps

    pfx=$(cd -P "$HOME" && pwd)

but I think the true issue may be that we set up fake HOME using TRASH_DIRECTORY that is before we canonicalize it with "cd -P".

Would doing something like this (without any other changes we discussed so far) help?

 t/test-lib.sh | 2 ++
 1 file changed, 2 insertions(+)
diff --git c/t/test-lib.sh w/t/test-lib.sh
index af722d383d..92d0db13d7 100644
--- c/t/test-lib.sh
+++ w/t/test-lib.sh
@@ -1577,6 +1577,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"
 
Previous: Eric SunshineNext: Mark Mentovai
Message 5 of 19 in “t7900: use pwd -P in macOS maintenance test”
  1. t7900: use pwd -P in macOS maintenance testMark Mentovai, May 23, 2025
  2. Eric SunshineMay 23, 2025
  3. Junio C HamanoMay 23, 2025
  4. Eric SunshineMay 23, 2025
  5. Junio C HamanoMay 23, 2025
  6. Mark MentovaiMay 24, 2025
  7. Junio C HamanoMay 27, 2025
  8. Mark MentovaiMay 23, 2025
  9. Eric SunshineMay 23, 2025
  10. t: run tests from a normalized working directoryMark Mentovai, May 28, 2025
  11. Torsten BögershausenMay 28, 2025
  12. Junio C HamanoMay 30, 2025
  13. Torsten BögershausenMay 31, 2025
  14. Junio C HamanoJun 1, 2025
  15. Mark MentovaiJun 2, 2025
  16. Junio C HamanoJun 2, 2025
  17. Torsten BögershausenJun 3, 2025
  18. Mark MentovaiJun 3, 2025
  19. Junio C HamanoJun 3, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.