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

[PATCH v4 10/10] t7800: work around the MSYS path conversion on Windows

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Dec 17, 2025, 14:18 UTC
Message-ID
<6caf8bf0b193f325ac4a3787b5619b8338154298.1765981126.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.2009.v4.git.1765981126.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>

Git's test suite's relies on Unix shell scripting, which is understandable, of course, given Git's firm roots (and indeed, ongoing focus) on Linux.

This fact, combined with Unix shell scripting's natural habitat -- which is, naturally... *drumroll*... Unix -- often has unintended side effects, where developers expect the test suite to run in a Unix environment, which is an incorrect assumption.

One instance of this problem can be observed in the 'difftool --dir-diff handles modified symlinks' test case in `t7800-difftool.sh`, which assumes that all absolute paths start with a forward slash. That assumption is incorrect in general, e.g. on Windows, where absolute paths have many shapes and forms, none of which starts with a forward slash.

The only saving grace is that this test case is currently not run on Windows because of the `SYMLINK` prerequisite. However, I am currently working towards upstreaming symbolic link support from Git for Windows to upstream Git, which will put a crack into that saving grace.

Let's change that test case so that it does not rely on absolute paths (which are passed to the "external command" `ls` as parameters and are therefore part of its output, and which the test case wants to filter out before verifying that the output is as expected) starting with a forward slash. Let's instead rely on the much more reliable fact that `ls` will output the path in a line that ends in a colon, and simply filter out those lines by matching said colon instead.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t7800-difftool.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index 9b74db5563..bf0f67378d 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -752,11 +752,11 @@ test_expect_success SYMLINKS 'difftool --dir-diff handles modified symlinks' '
 		c
 	EOF
 	git difftool --symlinks --dir-diff --extcmd ls >output &&
-	grep -v ^/ output >actual &&
+	grep -v ":\$" output >actual &&
 	test_cmp expect actual &&
 
 	git difftool --no-symlinks --dir-diff --extcmd ls >output &&
-	grep -v ^/ output >actual &&
+	grep -v ":\$" output >actual &&
 	test_cmp expect actual &&
 
 	# The left side contains symlink "c" that points to "b"
@@ -786,11 +786,11 @@ test_expect_success SYMLINKS 'difftool --dir-diff handles modified symlinks' '
 
 	EOF
 	git difftool --symlinks --dir-diff --extcmd ls >output &&
-	grep -v ^/ output >actual &&
+	grep -v ":\$" output >actual &&
 	test_cmp expect actual &&
 
 	git difftool --no-symlinks --dir-diff --extcmd ls >output &&
-	grep -v ^/ output >actual &&
+	grep -v ":\$" output >actual &&
 	test_cmp expect actual
 '
 
-- 
gitgitgadget
Previous: Johannes Schindelin via GitGitGadgetNext: Junio C Hamano
Message 67 of 68 in “Prepare Git's test suite for symbolic link support on Windows”
  1. 00/10 Prepare Git's test suite for symbolic link support on WindowsJohannes Schindelin via GitGitGadget, Nov 29, 2025
  2. 01/10 t9700: accommodate for Windows pathsJohannes Schindelin via GitGitGadget, Nov 29, 2025
  3. 02/10 apply: symbolic links lack a "trustable executable bit"Johannes Schindelin via GitGitGadget, Nov 29, 2025
  4. 03/10 mingw: special-case `open(symlink, O_CREAT | O_EXCL)`Johannes Schindelin via GitGitGadget, Nov 29, 2025
  5. Junio C HamanoNov 30, 2025
  6. Johannes SchindelinDec 1, 2025
  7. Junio C HamanoDec 6, 2025
  8. 04/10 t0001: handle `diff --no-index` gracefullyJohannes Schindelin via GitGitGadget, Nov 29, 2025
  9. Junio C HamanoNov 30, 2025
  10. Johannes SchindelinDec 1, 2025
  11. Junio C HamanoDec 2, 2025
  12. 05/10 t0301: another fix for Windows compatibilityJohannes Schindelin via GitGitGadget, Nov 29, 2025
  13. Junio C HamanoNov 30, 2025
  14. Johannes SchindelinDec 1, 2025
  15. Junio C HamanoDec 2, 2025
  16. Johannes SchindelinDec 2, 2025
  17. Junio C HamanoDec 6, 2025
  18. 06/10 t0600: fix incomplete prerequisite for a test caseJohannes Schindelin via GitGitGadget, Nov 29, 2025
  19. Patrick SteinhardtDec 1, 2025
  20. Johannes SchindelinDec 1, 2025
  21. 07/10 t1006: accommodate for symlink support in MSYS2Johannes Schindelin via GitGitGadget, Nov 29, 2025
  22. Patrick SteinhardtDec 1, 2025
  23. Johannes SchindelinDec 1, 2025
  24. Patrick SteinhardtDec 1, 2025
  25. 08/10 t1305: skip symlink tests that do not apply to WindowsJohannes Schindelin via GitGitGadget, Nov 29, 2025
  26. 09/10 t6423: introduce Windows-specific handling for symlinking to /dev/nullJohannes Schindelin via GitGitGadget, Nov 29, 2025
  27. 10/10 t7800: work around the MSYS path conversion on WindowsJohannes Schindelin via GitGitGadget, Nov 29, 2025
  28. Junio C HamanoNov 30, 2025
  29. Eric SunshineNov 30, 2025
  30. Johannes SchindelinDec 1, 2025
  31. 00/10 Prepare Git's test suite for symbolic link support on WindowsJohannes Schindelin via GitGitGadget, Dec 5, 2025
  32. 02/10 apply: symbolic links lack a "trustable executable bit"Johannes Schindelin via GitGitGadget, Dec 5, 2025
  33. 01/10 t9700: accommodate for Windows pathsJohannes Schindelin via GitGitGadget, Dec 5, 2025
  34. 03/10 mingw: special-case `open(symlink, O_CREAT | O_EXCL)`Johannes Schindelin via GitGitGadget, Dec 5, 2025
  35. 04/10 t0001: handle `diff --no-index` gracefullyJohannes Schindelin via GitGitGadget, Dec 5, 2025
  36. 05/10 t0301: another fix for Windows compatibilityJohannes Schindelin via GitGitGadget, Dec 5, 2025
  37. 06/10 t0600: fix incomplete prerequisite for a test caseJohannes Schindelin via GitGitGadget, Dec 5, 2025
  38. 07/10 t1006: accommodate for symlink support in MSYS2Johannes Schindelin via GitGitGadget, Dec 5, 2025
  39. 08/10 t1305: skip symlink tests that do not apply to WindowsJohannes Schindelin via GitGitGadget, Dec 5, 2025
  40. 09/10 t6423: introduce Windows-specific handling for symlinking to /dev/nullJohannes Schindelin via GitGitGadget, Dec 5, 2025
  41. 10/10 t7800: work around the MSYS path conversion on WindowsJohannes Schindelin via GitGitGadget, Dec 5, 2025
  42. Patrick SteinhardtDec 9, 2025
  43. Junio C HamanoDec 9, 2025
  44. 00/10 Prepare Git's test suite for symbolic link support on WindowsJohannes Schindelin via GitGitGadget, Dec 16, 2025
  45. 01/10 t9700: accommodate for Windows pathsJohannes Schindelin via GitGitGadget, Dec 16, 2025
  46. 02/10 apply: symbolic links lack a "trustable executable bit"Johannes Schindelin via GitGitGadget, Dec 16, 2025
  47. 03/10 mingw: special-case `open(symlink, O_CREAT | O_EXCL)`Johannes Schindelin via GitGitGadget, Dec 16, 2025
  48. 04/10 t0001: handle `diff --no-index` gracefullyJohannes Schindelin via GitGitGadget, Dec 16, 2025
  49. 05/10 t0301: another fix for Windows compatibilityJohannes Schindelin via GitGitGadget, Dec 16, 2025
  50. 07/10 t1006: accommodate for symlink support in MSYS2Johannes Schindelin via GitGitGadget, Dec 16, 2025
  51. 08/10 t1305: skip symlink tests that do not apply to WindowsJohannes Schindelin via GitGitGadget, Dec 16, 2025
  52. 09/10 t6423: introduce Windows-specific handling for symlinking to /dev/nullJohannes Schindelin via GitGitGadget, Dec 16, 2025
  53. 10/10 t7800: work around the MSYS path conversion on WindowsJohannes Schindelin via GitGitGadget, Dec 16, 2025
  54. Junio C HamanoDec 16, 2025
  55. Johannes SchindelinDec 16, 2025
  56. Junio C HamanoDec 17, 2025
  57. 00/10 Prepare Git's test suite for symbolic link support on WindowsJohannes Schindelin via GitGitGadget, Dec 17, 2025
  58. 01/10 t9700: accommodate for Windows pathsJohannes Schindelin via GitGitGadget, Dec 17, 2025
  59. 02/10 apply: symbolic links lack a "trustable executable bit"Johannes Schindelin via GitGitGadget, Dec 17, 2025
  60. 03/10 mingw: special-case `open(symlink, O_CREAT | O_EXCL)`Johannes Schindelin via GitGitGadget, Dec 17, 2025
  61. 04/10 t0001: handle `diff --no-index` gracefullyJohannes Schindelin via GitGitGadget, Dec 17, 2025
  62. 05/10 t0301: another fix for Windows compatibilityJohannes Schindelin via GitGitGadget, Dec 17, 2025
  63. 06/10 t0600: fix incomplete prerequisite for a test caseJohannes Schindelin via GitGitGadget, Dec 17, 2025
  64. 07/10 t1006: accommodate for symlink support in MSYS2Johannes Schindelin via GitGitGadget, Dec 17, 2025
  65. 08/10 t1305: skip symlink tests that do not apply to WindowsJohannes Schindelin via GitGitGadget, Dec 17, 2025
  66. 09/10 t6423: introduce Windows-specific handling for symlinking to /dev/nullJohannes Schindelin via GitGitGadget, Dec 17, 2025
  67. 10/10 t7800: work around the MSYS path conversion on WindowsJohannes Schindelin via GitGitGadget, Dec 17, 2025
  68. Junio C HamanoDec 17, 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.