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

[PATCH v2] t4130: work around Windows limitation

From
Johannes Sixt <j6t@kdbg.org>
Date
Aug 3, 2016, 06:15 UTC
Message-ID
<244e3458-4a41-49bf-fba2-71da872e7f66@kdbg.org>
In-Reply-To
<alpine.DEB.2.20.1607301011140.11824@virtualbox>

On Windows, it is already pretty expensive to try to recreate the stat() data that Git assumes is cheap to obtain. To make things halfway decent in performance, we even have to skip emulating the inode and to determine the number of hard links.

This is not a huge problem, usually, as either the size or the mtime or the ctime are tell-tale enough to say when a file has changed, and even if not, those changes are typically made after the index file was written, triggering a rehashing of the files' contents.

The t4130-apply-criss-cross-rename test case, however, requires the inode to determine that files of equal size were swapped, as renaming files does not update their mtime. Every once in a while, t4130 fails on Windows because of this missing piece.

Equal file sizes are not crucial for the test cases, however. Hence, generate files with different sizes so that there is some property that the swapped files can be discovered reliably even on Windows.

Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 This fell through the cracks, I think. I marked it as v2 because
 there is a minor fixup in the commit message.
 t/t4130-apply-criss-cross-rename.sh | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/t/t4130-apply-criss-cross-rename.sh b/t/t4130-apply-criss-cross-rename.sh
index d173acd..f8a313b 100755
--- a/t/t4130-apply-criss-cross-rename.sh
+++ b/t/t4130-apply-criss-cross-rename.sh
@@ -13,9 +13,13 @@ create_file() {
 }
  test_expect_success 'setup' '
-	create_file file1 "File1 contents" &&
-	create_file file2 "File2 contents" &&
-	create_file file3 "File3 contents" &&
+	# Ensure that file sizes are different, because on Windows
+	# lstat() does not discover inode numbers, and we need
+	# other properties to discover swapped files
+	# (mtime is not always different, either).
+	create_file file1 "some content" &&
+	create_file file2 "some other content" &&
+	create_file file3 "again something else" &&
 	git add file1 file2 file3 &&
 	git commit -m 1
 '
-- 
2.9.0.443.ga8520ad
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 5 of 8 in “t4130: work around Windows limitation”
  1. t4130: work around Windows limitationJohannes Schindelin, Jul 27, 2016
  2. Johannes SixtJul 27, 2016
  3. Junio C HamanoJul 27, 2016
  4. Johannes SchindelinJul 30, 2016
  5. t4130: work around Windows limitationJohannes Sixt, Aug 3, 2016
  6. Johannes SchindelinAug 3, 2016
  7. Junio C HamanoAug 3, 2016
  8. Johannes SixtAug 4, 2016

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.