From: Johannes Schindelin <johannes.schindelin@gmx.de>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] t4130: work around Windows limitation
Date: Wed, 27 Jul 2016 14:39:28 +0200 (CEST) [thread overview]
Message-ID: <5bd59ca2f87e388350f3c8fb17c9a287661cd055.1469623136.git.johannes.schindelin@gmx.de> (raw)
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@gmx.de>
---
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
next reply other threads:[~2016-07-27 12:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-27 12:39 Johannes Schindelin [this message]
2016-07-27 16:37 ` [PATCH] t4130: work around Windows limitation Johannes Sixt
2016-07-27 16:40 ` Junio C Hamano
2016-07-30 8:11 ` Johannes Schindelin
2016-08-03 6:15 ` [PATCH v2] " Johannes Sixt
2016-08-03 12:03 ` Johannes Schindelin
2016-08-03 15:50 ` Junio C Hamano
2016-08-04 5:31 ` Johannes Sixt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5bd59ca2f87e388350f3c8fb17c9a287661cd055.1469623136.git.johannes.schindelin@gmx.de \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).