{"thread":{"id":"42940","subject":"[PATCH] t4130: work around Windows limitation","startedAt":"2016-07-27T12:39:43Z","lastAt":"2016-08-04T05:31:49Z","messageCount":8,"participants":["Johannes Schindelin","Johannes Sixt","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"292312","messageId":"5bd59ca2f87e388350f3c8fb17c9a287661cd055.1469623136.git.johannes.schindelin@gmx.de","threadId":"42940","inReplyTo":null,"subject":"[PATCH] t4130: work around Windows limitation","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-07-27T12:39:28Z","receivedAt":"2016-07-27T12:39:43Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"On Windows, it is already pretty expensive to try to recreate the stat()\ndata that Git assumes is cheap to obtain. To make things halfway decent\nin performance, we even have to skip emulating the inode and to\ndetermine the number of hard links.\n\nThis is not a huge problem, usually, as either the size or the mtime or\nthe ctime are tell-tale enough to say when a file has changed, and even\nif not, those changes are typically made after the index file was\nwritten, triggering a rehashing of the files' contents.\n\nThe t4130-apply-criss-cross-rename test case, however, requires the\ninode to determine that files of equal size were swapped, as renaming\nfiles does not update their mtime. And even if we use\nnanosecond-precision mtimes on Windows, the file system's time\ngranularity is typically much coarser (100ms for NTFS, 2s for FAT).\n\nThat means that every once in a while, t4130 fails on Windows.\n\nThis patch provides the work-around by pretending that the index file\nwas written earlier than it actually was.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\nPublished-As: https://github.com/dscho/git/releases/tag/t4130-mingw-v1\n t/t4130-apply-criss-cross-rename.sh | 16 ++++++++++++++++\n 1 file changed, 16 insertions(+)\n\ndiff --git a/t/t4130-apply-criss-cross-rename.sh b/t/t4130-apply-criss-cross-rename.sh\nindex d173acd..ee91af8 100755\n--- a/t/t4130-apply-criss-cross-rename.sh\n+++ b/t/t4130-apply-criss-cross-rename.sh\n@@ -29,6 +29,14 @@ test_expect_success 'criss-cross rename' '\n '\n \n test_expect_success 'diff -M -B' '\n+\tif test_have_prereq MINGW\n+\tthen\n+\t\t# On Windows it is prohbitively expensive to retrieve the\n+\t\t# equivalent of an \"inode\" when calling stat(), therefore we\n+\t\t# rely on mtime/ctime/size changes to let us know whether a\n+\t\t# file has changed, including the mtime relative to the index.\n+\t\ttest-chmtime -1 .git/index\n+\tfi &&\n \tgit diff -M -B > diff &&\n \tgit reset --hard\n \n@@ -52,6 +60,14 @@ test_expect_success 'criss-cross rename' '\n '\n \n test_expect_success 'diff -M -B' '\n+\tif test_have_prereq MINGW\n+\tthen\n+\t\t# On Windows it is prohbitively expensive to retrieve the\n+\t\t# equivalent of an \"inode\" when calling stat(), therefore we\n+\t\t# rely on mtime/ctime/size changes to let us know whether a\n+\t\t# file has changed, including the mtime relative to the index.\n+\t\ttest-chmtime -1 .git/index\n+\tfi &&\n \tgit diff -M -B > diff &&\n \tgit reset --hard\n '\n-- \n2.9.0.281.g286a8d9\n\nbase-commit: 8c6d1f9807c67532e7fb545a944b064faff0f70b\n"},{"id":"292328","messageId":"9d167448-84ce-e368-0bb4-41aa4452268d@kdbg.org","threadId":"42940","inReplyTo":"5bd59ca2f87e388350f3c8fb17c9a287661cd055.1469623136.git.johannes.schindelin@gmx.de","subject":"Re: [PATCH] t4130: work around Windows limitation","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2016-07-27T16:37:19Z","receivedAt":"2016-07-27T16:37:28Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 27.07.2016 um 14:39 schrieb Johannes Schindelin:\n> On Windows, it is already pretty expensive to try to recreate the stat()\n> data that Git assumes is cheap to obtain. To make things halfway decent\n> in performance, we even have to skip emulating the inode and to\n> determine the number of hard links.\n> \n> This is not a huge problem, usually, as either the size or the mtime or\n> the ctime are tell-tale enough to say when a file has changed, and even\n> if not, those changes are typically made after the index file was\n> written, triggering a rehashing of the files' contents.\n> \n> The t4130-apply-criss-cross-rename test case, however, requires the\n> inode to determine that files of equal size were swapped, as renaming\n> files does not update their mtime. And even if we use\n> nanosecond-precision mtimes on Windows, the file system's time\n> granularity is typically much coarser (100ms for NTFS, 2s for FAT).\n> \n> That means that every once in a while, t4130 fails on Windows.\n> \n> This patch provides the work-around by pretending that the index file\n> was written earlier than it actually was.\n> \n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> ---\n> Published-As: https://github.com/dscho/git/releases/tag/t4130-mingw-v1\n>  t/t4130-apply-criss-cross-rename.sh | 16 ++++++++++++++++\n>  1 file changed, 16 insertions(+)\n> \n> diff --git a/t/t4130-apply-criss-cross-rename.sh b/t/t4130-apply-criss-cross-rename.sh\n> index d173acd..ee91af8 100755\n> --- a/t/t4130-apply-criss-cross-rename.sh\n> +++ b/t/t4130-apply-criss-cross-rename.sh\n> @@ -29,6 +29,14 @@ test_expect_success 'criss-cross rename' '\n>  '\n>  \n>  test_expect_success 'diff -M -B' '\n> +\tif test_have_prereq MINGW\n> +\tthen\n> +\t\t# On Windows it is prohbitively expensive to retrieve the\n> +\t\t# equivalent of an \"inode\" when calling stat(), therefore we\n> +\t\t# rely on mtime/ctime/size changes to let us know whether a\n> +\t\t# file has changed, including the mtime relative to the index.\n> +\t\ttest-chmtime -1 .git/index\n> +\tfi &&\n>  \tgit diff -M -B > diff &&\n>  \tgit reset --hard\n>  \n> @@ -52,6 +60,14 @@ test_expect_success 'criss-cross rename' '\n>  '\n>  \n>  test_expect_success 'diff -M -B' '\n> +\tif test_have_prereq MINGW\n> +\tthen\n> +\t\t# On Windows it is prohbitively expensive to retrieve the\n> +\t\t# equivalent of an \"inode\" when calling stat(), therefore we\n> +\t\t# rely on mtime/ctime/size changes to let us know whether a\n> +\t\t# file has changed, including the mtime relative to the index.\n> +\t\ttest-chmtime -1 .git/index\n> +\tfi &&\n>  \tgit diff -M -B > diff &&\n>  \tgit reset --hard\n>  '\n> \n\nHow about this instead? It makes the sizes of the files different,\nwhich is a bit less obscure, IMHO.\n\n---- 8< ----\n[PATCH] t4130: work around Windows limitation\n\nOn Windows, it is already pretty expensive to try to recreate the stat()\ndata that Git assumes is cheap to obtain. To make things halfway decent\nin performance, we even have to skip emulating the inode and to\ndetermine the number of hard links.\n\nThis is not a huge problem, usually, as either the size or the mtime or\nthe ctime are tell-tale enough to say when a file has changed, and even\nif not, those changes are typically made after the index file was\nwritten, triggering a rehashing of the files' contents.\n\nThe t4130-apply-criss-cross-rename test case, however, requires the\ninode to determine that files of equal size were swapped, as renaming\nfiles does not update their mtime. Every once in a while, t4130 fails\non Windows of this missing piece.\n\nEqual file sizes are not crucial for the test cases, however. Hence,\ngenerate files with different sizes so that there is some property that\nthe swapped files can be discovered reliably even on Windows.\n\nHelped-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Johannes Sixt <j6t@kdbg.org>\n---\n t/t4130-apply-criss-cross-rename.sh | 10 +++++++---\n 1 file changed, 7 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t4130-apply-criss-cross-rename.sh b/t/t4130-apply-criss-cross-rename.sh\nindex d173acd..f8a313b 100755\n--- a/t/t4130-apply-criss-cross-rename.sh\n+++ b/t/t4130-apply-criss-cross-rename.sh\n@@ -13,9 +13,13 @@ create_file() {\n }\n \n test_expect_success 'setup' '\n-\tcreate_file file1 \"File1 contents\" &&\n-\tcreate_file file2 \"File2 contents\" &&\n-\tcreate_file file3 \"File3 contents\" &&\n+\t# Ensure that file sizes are different, because on Windows\n+\t# lstat() does not discover inode numbers, and we need\n+\t# other properties to discover swapped files\n+\t# (mtime is not always different, either).\n+\tcreate_file file1 \"some content\" &&\n+\tcreate_file file2 \"some other content\" &&\n+\tcreate_file file3 \"again something else\" &&\n \tgit add file1 file2 file3 &&\n \tgit commit -m 1\n '\n-- \n2.9.0.443.ga8520ad\n\n"},{"id":"292329","messageId":"CAPc5daW10y_5rat0Au-1NWXUf2QYFrDfQeprqq9NsYPBjdqOTw@mail.gmail.com","threadId":"42940","inReplyTo":"9d167448-84ce-e368-0bb4-41aa4452268d@kdbg.org","subject":"Re: [PATCH] t4130: work around Windows limitation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-07-27T16:40:17Z","receivedAt":"2016-07-27T16:40:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"On Wed, Jul 27, 2016 at 9:37 AM, Johannes Sixt <j6t@kdbg.org> wrote:\n>\n> How about this instead? It makes the sizes of the files different,\n> which is a bit less obscure, IMHO.\n> ...\n> Equal file sizes are not crucial for the test cases, however.\n\nThat does sounds like a better solution.\n"},{"id":"292591","messageId":"alpine.DEB.2.20.1607301011140.11824@virtualbox","threadId":"42940","inReplyTo":"CAPc5daW10y_5rat0Au-1NWXUf2QYFrDfQeprqq9NsYPBjdqOTw@mail.gmail.com","subject":"Re: [PATCH] t4130: work around Windows limitation","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-07-30T08:11:36Z","receivedAt":"2016-07-30T08:11:51Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 27 Jul 2016, Junio C Hamano wrote:\n\n> On Wed, Jul 27, 2016 at 9:37 AM, Johannes Sixt <j6t@kdbg.org> wrote:\n> >\n> > How about this instead? It makes the sizes of the files different,\n> > which is a bit less obscure, IMHO.\n> > ...\n> > Equal file sizes are not crucial for the test cases, however.\n> \n> That does sounds like a better solution.\n\nFine by me.\n\nThanks,\nDscho\n"},{"id":"292883","messageId":"244e3458-4a41-49bf-fba2-71da872e7f66@kdbg.org","threadId":"42940","inReplyTo":"alpine.DEB.2.20.1607301011140.11824@virtualbox","subject":"[PATCH v2] t4130: work around Windows limitation","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2016-08-03T06:15:03Z","receivedAt":"2016-08-03T06:16:25Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"On Windows, it is already pretty expensive to try to recreate the stat()\ndata that Git assumes is cheap to obtain. To make things halfway decent\nin performance, we even have to skip emulating the inode and to\ndetermine the number of hard links.\n\nThis is not a huge problem, usually, as either the size or the mtime or\nthe ctime are tell-tale enough to say when a file has changed, and even\nif not, those changes are typically made after the index file was\nwritten, triggering a rehashing of the files' contents.\n\nThe t4130-apply-criss-cross-rename test case, however, requires the\ninode to determine that files of equal size were swapped, as renaming\nfiles does not update their mtime. Every once in a while, t4130 fails\non Windows because of this missing piece.\n\nEqual file sizes are not crucial for the test cases, however. Hence,\ngenerate files with different sizes so that there is some property that\nthe swapped files can be discovered reliably even on Windows.\n\nHelped-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Johannes Sixt <j6t@kdbg.org>\n---\n This fell through the cracks, I think. I marked it as v2 because\n there is a minor fixup in the commit message.\n\n t/t4130-apply-criss-cross-rename.sh | 10 +++++++---\n 1 file changed, 7 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t4130-apply-criss-cross-rename.sh b/t/t4130-apply-criss-cross-rename.sh\nindex d173acd..f8a313b 100755\n--- a/t/t4130-apply-criss-cross-rename.sh\n+++ b/t/t4130-apply-criss-cross-rename.sh\n@@ -13,9 +13,13 @@ create_file() {\n }\n  test_expect_success 'setup' '\n-\tcreate_file file1 \"File1 contents\" &&\n-\tcreate_file file2 \"File2 contents\" &&\n-\tcreate_file file3 \"File3 contents\" &&\n+\t# Ensure that file sizes are different, because on Windows\n+\t# lstat() does not discover inode numbers, and we need\n+\t# other properties to discover swapped files\n+\t# (mtime is not always different, either).\n+\tcreate_file file1 \"some content\" &&\n+\tcreate_file file2 \"some other content\" &&\n+\tcreate_file file3 \"again something else\" &&\n \tgit add file1 file2 file3 &&\n \tgit commit -m 1\n '\n-- \n2.9.0.443.ga8520ad\n\n"},{"id":"292893","messageId":"alpine.DEB.2.20.1608031401370.79248@virtualbox","threadId":"42940","inReplyTo":"244e3458-4a41-49bf-fba2-71da872e7f66@kdbg.org","subject":"Re: [PATCH v2] t4130: work around Windows limitation","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-08-03T12:03:54Z","receivedAt":"2016-08-03T12:13:01Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Hannes,\n\nOn Wed, 3 Aug 2016, Johannes Sixt wrote:\n\n>  This fell through the cracks, I think. I marked it as v2 because\n>  there is a minor fixup in the commit message.\n\nIt appears that it did fall through the cracks.\n\nGiven that it would make my life substantially easier (because I run the\ntest suite often enough to hit this edge case multiple times a day), I\nwould like to ask to fast-track it into v2.9.3.\n\nThanks,\nDscho\n"},{"id":"292905","messageId":"xmqq4m71c0mz.fsf@gitster.mtv.corp.google.com","threadId":"42940","inReplyTo":"244e3458-4a41-49bf-fba2-71da872e7f66@kdbg.org","subject":"Re: [PATCH v2] t4130: work around Windows limitation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-08-03T15:50:28Z","receivedAt":"2016-08-03T17:04:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j6t@kdbg.org> writes:\n\n>  This fell through the cracks, I think. I marked it as v2 because\n>  there is a minor fixup in the commit message.\n\nThanks.  The patch itself seems to got whitespace damaged somewhere\nbetween you and me, which I fixed up, but there may be similar\ndamage to the proposed log message as well.  What I read may already\nhave whitespace damaged but I read the message twice and it made\nsense to me, so let's assume all is well ;-)\n\nThanks.\n\n>\n>  t/t4130-apply-criss-cross-rename.sh | 10 +++++++---\n>  1 file changed, 7 insertions(+), 3 deletions(-)\n>\n> diff --git a/t/t4130-apply-criss-cross-rename.sh b/t/t4130-apply-criss-cross-rename.sh\n> index d173acd..f8a313b 100755\n> --- a/t/t4130-apply-criss-cross-rename.sh\n> +++ b/t/t4130-apply-criss-cross-rename.sh\n> @@ -13,9 +13,13 @@ create_file() {\n>  }\n>   test_expect_success 'setup' '\n> -\tcreate_file file1 \"File1 contents\" &&\n> -\tcreate_file file2 \"File2 contents\" &&\n> -\tcreate_file file3 \"File3 contents\" &&\n> +\t# Ensure that file sizes are different, because on Windows\n> +\t# lstat() does not discover inode numbers, and we need\n> +\t# other properties to discover swapped files\n> +\t# (mtime is not always different, either).\n> +\tcreate_file file1 \"some content\" &&\n> +\tcreate_file file2 \"some other content\" &&\n> +\tcreate_file file3 \"again something else\" &&\n>  \tgit add file1 file2 file3 &&\n>  \tgit commit -m 1\n>  '\n"},{"id":"293064","messageId":"d00bfb15-a510-834a-9569-fa3fdb2db62c@kdbg.org","threadId":"42940","inReplyTo":"xmqq4m71c0mz.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2] t4130: work around Windows limitation","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2016-08-04T05:31:39Z","receivedAt":"2016-08-04T05:31:49Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 03.08.2016 um 17:50 schrieb Junio C Hamano:\n> Johannes Sixt <j6t@kdbg.org> writes:\n> The patch itself seems to got whitespace damaged somewhere\n> between you and me, which I fixed up,\n\nSorry for the damaged patch. I forgot that Thunderbird's \"Send again\" \nfeature as well as copying and pasting between Thunderbird windows is \npoison for patch text.\n\nWhat you have queued in js/t4130-rename-without-ino is correct. Thank \nyou very much!\n\n-- Hannes\n\n"}]}