[PATCH] t4130: work around Windows limitation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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. And even if we use
nanosecond-precision mtimes on Windows, the file system's time
granularity is typically much coarser (100ms for NTFS, 2s for FAT).

That means that every once in a while, t4130 fails on Windows.

This patch provides the work-around by pretending that the index file
was written earlier than it actually was.

Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx>
---
Published-As: https://github.com/dscho/git/releases/tag/t4130-mingw-v1
 t/t4130-apply-criss-cross-rename.sh | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/t/t4130-apply-criss-cross-rename.sh b/t/t4130-apply-criss-cross-rename.sh
index d173acd..ee91af8 100755
--- a/t/t4130-apply-criss-cross-rename.sh
+++ b/t/t4130-apply-criss-cross-rename.sh
@@ -29,6 +29,14 @@ test_expect_success 'criss-cross rename' '
 '
 
 test_expect_success 'diff -M -B' '
+	if test_have_prereq MINGW
+	then
+		# On Windows it is prohbitively expensive to retrieve the
+		# equivalent of an "inode" when calling stat(), therefore we
+		# rely on mtime/ctime/size changes to let us know whether a
+		# file has changed, including the mtime relative to the index.
+		test-chmtime -1 .git/index
+	fi &&
 	git diff -M -B > diff &&
 	git reset --hard
 
@@ -52,6 +60,14 @@ test_expect_success 'criss-cross rename' '
 '
 
 test_expect_success 'diff -M -B' '
+	if test_have_prereq MINGW
+	then
+		# On Windows it is prohbitively expensive to retrieve the
+		# equivalent of an "inode" when calling stat(), therefore we
+		# rely on mtime/ctime/size changes to let us know whether a
+		# file has changed, including the mtime relative to the index.
+		test-chmtime -1 .git/index
+	fi &&
 	git diff -M -B > diff &&
 	git reset --hard
 '
-- 
2.9.0.281.g286a8d9

base-commit: 8c6d1f9807c67532e7fb545a944b064faff0f70b
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]