From: Johannes Schindelin <hidden> Date: 2016-07-27 12:39:43
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 <redacted>
---
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(+)
@@ -29,6 +29,14 @@ test_expect_success 'criss-cross rename' '' test_expect_success'diff -M -B''+iftest_have_prereqMINGW+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&&gitdiff-M-B>diff&&gitreset--hard
@@ -52,6 +60,14 @@ test_expect_success 'criss-cross rename' '' test_expect_success'diff -M -B''+iftest_have_prereqMINGW+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&&gitdiff-M-B>diff&&gitreset--hard'
From: Johannes Sixt <hidden> Date: 2016-07-27 16:37:28
Am 27.07.2016 um 14:39 schrieb Johannes Schindelin:
quoted hunk
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 <redacted>
---
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(+)
@@ -29,6 +29,14 @@ test_expect_success 'criss-cross rename' '' test_expect_success'diff -M -B''+iftest_have_prereqMINGW+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&&gitdiff-M-B>diff&&gitreset--hard
@@ -52,6 +60,14 @@ test_expect_success 'criss-cross rename' '' test_expect_success'diff -M -B''+iftest_have_prereqMINGW+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&&gitdiff-M-B>diff&&gitreset--hard'
How about this instead? It makes the sizes of the files different,
which is a bit less obscure, IMHO.
---- 8< ----
[PATCH] t4130: work around Windows limitation
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 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 [off-list ref]
Signed-off-by: Johannes Sixt <redacted>
---
t/t4130-apply-criss-cross-rename.sh | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
@@ -13,9 +13,13 @@ create_file() {} test_expect_success'setup''-create_filefile1"File1 contents"&&-create_filefile2"File2 contents"&&-create_filefile3"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_filefile1"some content"&&+create_filefile2"some other content"&&+create_filefile3"again something else"&&gitaddfile1file2file3&&gitcommit-m1'
From: Junio C Hamano <hidden> Date: 2016-07-27 16:40:41
On Wed, Jul 27, 2016 at 9:37 AM, Johannes Sixt [off-list ref] wrote:
How about this instead? It makes the sizes of the files different,
which is a bit less obscure, IMHO.
...
Equal file sizes are not crucial for the test cases, however.
From: Johannes Schindelin <hidden> Date: 2016-07-30 08:11:51
Hi,
On Wed, 27 Jul 2016, Junio C Hamano wrote:
On Wed, Jul 27, 2016 at 9:37 AM, Johannes Sixt [off-list ref] wrote:
quoted
How about this instead? It makes the sizes of the files different,
which is a bit less obscure, IMHO.
...
Equal file sizes are not crucial for the test cases, however.
From: Johannes Sixt <hidden> Date: 2016-08-03 06:16:25
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 [off-list ref]
Signed-off-by: Johannes Sixt <redacted>
---
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(-)
@@ -13,9 +13,13 @@ create_file() {}test_expect_success'setup''-create_filefile1"File1 contents"&&-create_filefile2"File2 contents"&&-create_filefile3"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_filefile1"some content"&&+create_filefile2"some other content"&&+create_filefile3"again something else"&&gitaddfile1file2file3&&gitcommit-m1'
From: Johannes Schindelin <hidden> Date: 2016-08-03 12:13:01
Hi Hannes,
On Wed, 3 Aug 2016, Johannes Sixt wrote:
This fell through the cracks, I think. I marked it as v2 because
there is a minor fixup in the commit message.
It appears that it did fall through the cracks.
Given that it would make my life substantially easier (because I run the
test suite often enough to hit this edge case multiple times a day), I
would like to ask to fast-track it into v2.9.3.
Thanks,
Dscho