{"thread":{"id":"36834","subject":"[PATCH] t5000, t5003: do not use test_cmp to compare binary files","startedAt":"2014-06-04T11:42:52Z","lastAt":"2014-06-05T02:01:50Z","messageCount":7,"participants":["Stepan Kasal","Thomas Braun","Junio C Hamano","Michael Geddes"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"243283","messageId":"20140604114252.GA22250@camelia.ucw.cz","threadId":"36834","inReplyTo":null,"subject":"[PATCH] t5000, t5003: do not use test_cmp to compare binary files","fromName":"Stepan Kasal","fromEmail":"kasal@ucw.cz","sentAt":"2014-06-04T11:42:52Z","receivedAt":"2014-06-04T11:42:52Z","isPatch":true,"sender":{"key":"kasal@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/1481596?v=4"},"body":"test_cmp() is primarily meant to compare text files (and display the\ndifference for debug purposes).\n\nRaw \"cmp\" is better suited to compare binary files (tar, zip, etc.).\n\nOn MinGW, test_cmp is a shell function mingw_test_cmp that tries to\nread both files into environment, stripping CR characters (introduced\nin commit 4d715ac0).\n\nThis function usually speeds things up, as fork is extremly slow on\nWindows.  But no wonder that this function is extremely slow and\nsometimes even crashes when comparing large tar or zip files.\n\nSigned-off-by: Stepan Kasal <kasal@ucw.cz>\n---\n t/t5000-tar-tree.sh             | 34 +++++++++++++++++-----------------\n t/t5001-archive-attr.sh         |  2 +-\n t/t5003-archive-zip.sh          |  6 +++---\n t/t5004-archive-corner-cases.sh |  2 +-\n 4 files changed, 22 insertions(+), 22 deletions(-)\n\ndiff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh\nindex 1cf0a4e..31b1fd1 100755\n--- a/t/t5000-tar-tree.sh\n+++ b/t/t5000-tar-tree.sh\n@@ -164,7 +164,7 @@ check_tar with_olde-prefix olde-\n test_expect_success 'git archive on large files' '\n     test_config core.bigfilethreshold 1 &&\n     git archive HEAD >b3.tar &&\n-    test_cmp b.tar b3.tar\n+    cmp b.tar b3.tar\n '\n \n test_expect_success \\\n@@ -173,15 +173,15 @@ test_expect_success \\\n \n test_expect_success \\\n     'git archive vs. the same in a bare repo' \\\n-    'test_cmp b.tar b3.tar'\n+    'cmp b.tar b3.tar'\n \n test_expect_success 'git archive with --output' \\\n     'git archive --output=b4.tar HEAD &&\n-    test_cmp b.tar b4.tar'\n+    cmp b.tar b4.tar'\n \n test_expect_success 'git archive --remote' \\\n     'git archive --remote=. HEAD >b5.tar &&\n-    test_cmp b.tar b5.tar'\n+    cmp b.tar b5.tar'\n \n test_expect_success \\\n     'validate file modification time' \\\n@@ -198,7 +198,7 @@ test_expect_success \\\n \n test_expect_success 'git archive with --output, override inferred format' '\n \tgit archive --format=tar --output=d4.zip HEAD &&\n-\ttest_cmp b.tar d4.zip\n+\tcmp b.tar d4.zip\n '\n \n test_expect_success \\\n@@ -244,34 +244,34 @@ test_expect_success 'archive --list shows only enabled remote filters' '\n test_expect_success 'invoke tar filter by format' '\n \tgit archive --format=tar.foo HEAD >config.tar.foo &&\n \ttr ab ba <config.tar.foo >config.tar &&\n-\ttest_cmp b.tar config.tar &&\n+\tcmp b.tar config.tar &&\n \tgit archive --format=bar HEAD >config.bar &&\n \ttr ab ba <config.bar >config.tar &&\n-\ttest_cmp b.tar config.tar\n+\tcmp b.tar config.tar\n '\n \n test_expect_success 'invoke tar filter by extension' '\n \tgit archive -o config-implicit.tar.foo HEAD &&\n-\ttest_cmp config.tar.foo config-implicit.tar.foo &&\n+\tcmp config.tar.foo config-implicit.tar.foo &&\n \tgit archive -o config-implicit.bar HEAD &&\n-\ttest_cmp config.tar.foo config-implicit.bar\n+\tcmp config.tar.foo config-implicit.bar\n '\n \n test_expect_success 'default output format remains tar' '\n \tgit archive -o config-implicit.baz HEAD &&\n-\ttest_cmp b.tar config-implicit.baz\n+\tcmp b.tar config-implicit.baz\n '\n \n test_expect_success 'extension matching requires dot' '\n \tgit archive -o config-implicittar.foo HEAD &&\n-\ttest_cmp b.tar config-implicittar.foo\n+\tcmp b.tar config-implicittar.foo\n '\n \n test_expect_success 'only enabled filters are available remotely' '\n \ttest_must_fail git archive --remote=. --format=tar.foo HEAD \\\n \t\t>remote.tar.foo &&\n \tgit archive --remote=. --format=bar >remote.bar HEAD &&\n-\ttest_cmp remote.bar config.bar\n+\tcmp remote.bar config.bar\n '\n \n test_expect_success GZIP 'git archive --format=tgz' '\n@@ -280,27 +280,27 @@ test_expect_success GZIP 'git archive --format=tgz' '\n \n test_expect_success GZIP 'git archive --format=tar.gz' '\n \tgit archive --format=tar.gz HEAD >j1.tar.gz &&\n-\ttest_cmp j.tgz j1.tar.gz\n+\tcmp j.tgz j1.tar.gz\n '\n \n test_expect_success GZIP 'infer tgz from .tgz filename' '\n \tgit archive --output=j2.tgz HEAD &&\n-\ttest_cmp j.tgz j2.tgz\n+\tcmp j.tgz j2.tgz\n '\n \n test_expect_success GZIP 'infer tgz from .tar.gz filename' '\n \tgit archive --output=j3.tar.gz HEAD &&\n-\ttest_cmp j.tgz j3.tar.gz\n+\tcmp j.tgz j3.tar.gz\n '\n \n test_expect_success GZIP 'extract tgz file' '\n \tgzip -d -c <j.tgz >j.tar &&\n-\ttest_cmp b.tar j.tar\n+\tcmp b.tar j.tar\n '\n \n test_expect_success GZIP 'remote tar.gz is allowed by default' '\n \tgit archive --remote=. --format=tar.gz HEAD >remote.tar.gz &&\n-\ttest_cmp j.tgz remote.tar.gz\n+\tcmp j.tgz remote.tar.gz\n '\n \n test_expect_success GZIP 'remote tar.gz can be disabled' '\ndiff --git a/t/t5001-archive-attr.sh b/t/t5001-archive-attr.sh\nindex 51dedab..dfc35b3 100755\n--- a/t/t5001-archive-attr.sh\n+++ b/t/t5001-archive-attr.sh\n@@ -68,7 +68,7 @@ test_expect_missing\tworktree2/ignored-by-worktree\n \n test_expect_success 'git archive vs. bare' '\n \t(cd bare && git archive HEAD) >bare-archive.tar &&\n-\ttest_cmp archive.tar bare-archive.tar\n+\tcmp archive.tar bare-archive.tar\n '\n \n test_expect_success 'git archive with worktree attributes, bare' '\ndiff --git a/t/t5003-archive-zip.sh b/t/t5003-archive-zip.sh\nindex c72f71e..aa096f6 100755\n--- a/t/t5003-archive-zip.sh\n+++ b/t/t5003-archive-zip.sh\n@@ -97,15 +97,15 @@ test_expect_success \\\n \n test_expect_success \\\n     'git archive --format=zip vs. the same in a bare repo' \\\n-    'test_cmp d.zip d1.zip'\n+    'cmp d.zip d1.zip'\n \n test_expect_success 'git archive --format=zip with --output' \\\n     'git archive --format=zip --output=d2.zip HEAD &&\n-    test_cmp d.zip d2.zip'\n+    cmp d.zip d2.zip'\n \n test_expect_success 'git archive with --output, inferring format' '\n \tgit archive --output=d3.zip HEAD &&\n-\ttest_cmp d.zip d3.zip\n+\tcmp d.zip d3.zip\n '\n \n test_expect_success \\\ndiff --git a/t/t5004-archive-corner-cases.sh b/t/t5004-archive-corner-cases.sh\nindex 67f3b54..a980b10 100755\n--- a/t/t5004-archive-corner-cases.sh\n+++ b/t/t5004-archive-corner-cases.sh\n@@ -45,7 +45,7 @@ test_expect_success HEADER_ONLY_TAR_OK 'tar archive of commit with empty tree' '\n test_expect_success 'tar archive of empty tree is empty' '\n \tgit archive --format=tar HEAD: >empty.tar &&\n \tperl -e \"print \\\"\\\\0\\\" x 10240\" >10knuls.tar &&\n-\ttest_cmp 10knuls.tar empty.tar\n+\tcmp 10knuls.tar empty.tar\n '\n \n test_expect_success 'tar archive of empty tree with prefix' '\n-- \n2.0.0.9635.g0be03cb\n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/d/optout.\n"},{"id":"243285","messageId":"538F0D78.3020708@virtuell-zuhause.de","threadId":"36834","inReplyTo":"20140604114252.GA22250@camelia.ucw.cz","subject":"Re: [PATCH] t5000, t5003: do not use test_cmp to compare binary files","fromName":"Thomas Braun","fromEmail":"thomas.braun@virtuell-zuhause.de","sentAt":"2014-06-04T12:13:44Z","receivedAt":"2014-06-04T12:13:44Z","isPatch":true,"sender":{"key":"thomas.braun@virtuell-zuhause.de","avatar":"https://avatars.githubusercontent.com/u/1185677?v=4"},"body":"Am 04.06.2014 13:42, schrieb Stepan Kasal:\n> test_cmp() is primarily meant to compare text files (and display the\n> difference for debug purposes).\n> \n> Raw \"cmp\" is better suited to compare binary files (tar, zip, etc.).\n> \n> On MinGW, test_cmp is a shell function mingw_test_cmp that tries to\n> read both files into environment, stripping CR characters (introduced\n> in commit 4d715ac0).\n> \n> This function usually speeds things up, as fork is extremly slow on\n> Windows.  But no wonder that this function is extremely slow and\n> sometimes even crashes when comparing large tar or zip files.\n> \n> Signed-off-by: Stepan Kasal <kasal@ucw.cz>\n> ---\n>  t/t5000-tar-tree.sh             | 34 +++++++++++++++++-----------------\n>  t/t5001-archive-attr.sh         |  2 +-\n>  t/t5003-archive-zip.sh          |  6 +++---\n>  t/t5004-archive-corner-cases.sh |  2 +-\n>  4 files changed, 22 insertions(+), 22 deletions(-)\n> \n> diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh\n> index 1cf0a4e..31b1fd1 100755\n> --- a/t/t5000-tar-tree.sh\n> +++ b/t/t5000-tar-tree.sh\n> @@ -164,7 +164,7 @@ check_tar with_olde-prefix olde-\n>  test_expect_success 'git archive on large files' '\n>      test_config core.bigfilethreshold 1 &&\n>      git archive HEAD >b3.tar &&\n> -    test_cmp b.tar b3.tar\n> +    cmp b.tar b3.tar\n>  '\n\nWouldn't a function like test_cmp_bin() be better suited for all?\nThe windows folks can then use cmp inside test_cmp_bin() and all others\njust use test_cmp.\n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/d/optout.\n"},{"id":"243286","messageId":"20140604124257.GA22415@camelia.ucw.cz","threadId":"36834","inReplyTo":"538F0D78.3020708@virtuell-zuhause.de","subject":"Re: [PATCH] t5000, t5003: do not use test_cmp to compare binary files","fromName":"Stepan Kasal","fromEmail":"kasal@ucw.cz","sentAt":"2014-06-04T12:42:57Z","receivedAt":"2014-06-04T12:42:57Z","isPatch":true,"sender":{"key":"kasal@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/1481596?v=4"},"body":"Hello Thomas,\n\nOn Wed, Jun 04, 2014 at 02:13:44PM +0200, Thomas Braun wrote:\n> Wouldn't a function like test_cmp_bin() be better suited for all?\n\nI also considered it.  The advantage is that is shows that\nthis intentionally differs from test_cmp.\n\n> The windows folks can then use cmp inside test_cmp_bin() and all others\n\n... would use cmp as well because it is better suited for the task\nthan diff -u.  So test_cmp_bin would be just an alias for cmp, on all\nplatforms.  Doesn't that sound weird?\n\nStepan\n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/d/optout.\n"},{"id":"243287","messageId":"538F1840.7010803@virtuell-zuhause.de","threadId":"36834","inReplyTo":"20140604124257.GA22415@camelia.ucw.cz","subject":"Re: Re: [PATCH] t5000, t5003: do not use test_cmp to compare binary files","fromName":"Thomas Braun","fromEmail":"thomas.braun@virtuell-zuhause.de","sentAt":"2014-06-04T12:59:44Z","receivedAt":"2014-06-04T12:59:44Z","isPatch":true,"sender":{"key":"thomas.braun@virtuell-zuhause.de","avatar":"https://avatars.githubusercontent.com/u/1185677?v=4"},"body":"Hi Stephan,\n\nAm 04.06.2014 14:42, schrieb Stepan Kasal:\n> On Wed, Jun 04, 2014 at 02:13:44PM +0200, Thomas Braun wrote:\n>> Wouldn't a function like test_cmp_bin() be better suited for all?\n>\n> I also considered it.  The advantage is that is shows that\n> this intentionally differs from test_cmp.\n>\n>> The windows folks can then use cmp inside test_cmp_bin() and all others\n>\n> ... would use cmp as well because it is better suited for the task\n> than diff -u.  So test_cmp_bin would be just an alias for cmp, on all\n> platforms.  Doesn't that sound weird?\n\nI actually like the idea that the test assertions follow a common naming\nscheme and can easily be overriden by $arbitrary-crazy-platform.\n\nUsing test_cmp_bin instead of cmp would result in then four assertions\nfor comparing arbitrary data\ntest_cmp\ntest_18ncmp\ntest_cmp_text\ntest_cmp_bin\nwhere I think the purpose of each function is clear from its name.\n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/d/optout.\n"},{"id":"243305","messageId":"20140604155752.GA23226@camelia.ucw.cz","threadId":"36834","inReplyTo":"538F1840.7010803@virtuell-zuhause.de","subject":"[PATCH v2] t5000, t5003: do not use test_cmp to compare binary files","fromName":"Stepan Kasal","fromEmail":"kasal@ucw.cz","sentAt":"2014-06-04T15:57:52Z","receivedAt":"2014-06-04T15:57:52Z","isPatch":true,"sender":{"key":"kasal@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/1481596?v=4"},"body":"test_cmp() is primarily meant to compare text files (and display the\ndifference for debug purposes).\n\nRaw \"cmp\" is better suited to compare binary files (tar, zip, etc.).\n\nOn MinGW, test_cmp is a shell function mingw_test_cmp that tries to\nread both files into environment, stripping CR characters (introduced\nin commit 4d715ac0).\n\nThis function usually speeds things up, as fork is extremly slow on\nWindows.  But no wonder that this function is extremely slow and\nsometimes even crashes when comparing large tar or zip files.\n\nSigned-off-by: Stepan Kasal <kasal@ucw.cz>\n---\n\nHi Thomas,\nOn Wed, Jun 04, 2014 at 02:59:44PM +0200, Thomas Braun wrote:\n> Using test_cmp_bin instead of cmp would result in then four assertions\n> for comparing arbitrary data\n> test_cmp\n> test_i18ncmp\n> test_cmp_text\n> test_cmp_bin\n> where I think the purpose of each function is clear from its name.\n\n[test_cmp_text does not exist (yet)]\n\nOK, I agree, hence this modified version of the patch.\n\nStepan\n\n t/t5000-tar-tree.sh             | 34 +++++++++++++++++-----------------\n t/t5001-archive-attr.sh         |  2 +-\n t/t5003-archive-zip.sh          |  6 +++---\n t/t5004-archive-corner-cases.sh |  2 +-\n t/test-lib-functions.sh         |  6 ++++++\n 5 files changed, 28 insertions(+), 22 deletions(-)\n\ndiff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh\nindex 1cf0a4e..4efaf8c 100755\n--- a/t/t5000-tar-tree.sh\n+++ b/t/t5000-tar-tree.sh\n@@ -164,7 +164,7 @@ check_tar with_olde-prefix olde-\n test_expect_success 'git archive on large files' '\n     test_config core.bigfilethreshold 1 &&\n     git archive HEAD >b3.tar &&\n-    test_cmp b.tar b3.tar\n+    test_cmp_bin b.tar b3.tar\n '\n \n test_expect_success \\\n@@ -173,15 +173,15 @@ test_expect_success \\\n \n test_expect_success \\\n     'git archive vs. the same in a bare repo' \\\n-    'test_cmp b.tar b3.tar'\n+    'test_cmp_bin b.tar b3.tar'\n \n test_expect_success 'git archive with --output' \\\n     'git archive --output=b4.tar HEAD &&\n-    test_cmp b.tar b4.tar'\n+    test_cmp_bin b.tar b4.tar'\n \n test_expect_success 'git archive --remote' \\\n     'git archive --remote=. HEAD >b5.tar &&\n-    test_cmp b.tar b5.tar'\n+    test_cmp_bin b.tar b5.tar'\n \n test_expect_success \\\n     'validate file modification time' \\\n@@ -198,7 +198,7 @@ test_expect_success \\\n \n test_expect_success 'git archive with --output, override inferred format' '\n \tgit archive --format=tar --output=d4.zip HEAD &&\n-\ttest_cmp b.tar d4.zip\n+\ttest_cmp_bin b.tar d4.zip\n '\n \n test_expect_success \\\n@@ -244,34 +244,34 @@ test_expect_success 'archive --list shows only enabled remote filters' '\n test_expect_success 'invoke tar filter by format' '\n \tgit archive --format=tar.foo HEAD >config.tar.foo &&\n \ttr ab ba <config.tar.foo >config.tar &&\n-\ttest_cmp b.tar config.tar &&\n+\ttest_cmp_bin b.tar config.tar &&\n \tgit archive --format=bar HEAD >config.bar &&\n \ttr ab ba <config.bar >config.tar &&\n-\ttest_cmp b.tar config.tar\n+\ttest_cmp_bin b.tar config.tar\n '\n \n test_expect_success 'invoke tar filter by extension' '\n \tgit archive -o config-implicit.tar.foo HEAD &&\n-\ttest_cmp config.tar.foo config-implicit.tar.foo &&\n+\ttest_cmp_bin config.tar.foo config-implicit.tar.foo &&\n \tgit archive -o config-implicit.bar HEAD &&\n-\ttest_cmp config.tar.foo config-implicit.bar\n+\ttest_cmp_bin config.tar.foo config-implicit.bar\n '\n \n test_expect_success 'default output format remains tar' '\n \tgit archive -o config-implicit.baz HEAD &&\n-\ttest_cmp b.tar config-implicit.baz\n+\ttest_cmp_bin b.tar config-implicit.baz\n '\n \n test_expect_success 'extension matching requires dot' '\n \tgit archive -o config-implicittar.foo HEAD &&\n-\ttest_cmp b.tar config-implicittar.foo\n+\ttest_cmp_bin b.tar config-implicittar.foo\n '\n \n test_expect_success 'only enabled filters are available remotely' '\n \ttest_must_fail git archive --remote=. --format=tar.foo HEAD \\\n \t\t>remote.tar.foo &&\n \tgit archive --remote=. --format=bar >remote.bar HEAD &&\n-\ttest_cmp remote.bar config.bar\n+\ttest_cmp_bin remote.bar config.bar\n '\n \n test_expect_success GZIP 'git archive --format=tgz' '\n@@ -280,27 +280,27 @@ test_expect_success GZIP 'git archive --format=tgz' '\n \n test_expect_success GZIP 'git archive --format=tar.gz' '\n \tgit archive --format=tar.gz HEAD >j1.tar.gz &&\n-\ttest_cmp j.tgz j1.tar.gz\n+\ttest_cmp_bin j.tgz j1.tar.gz\n '\n \n test_expect_success GZIP 'infer tgz from .tgz filename' '\n \tgit archive --output=j2.tgz HEAD &&\n-\ttest_cmp j.tgz j2.tgz\n+\ttest_cmp_bin j.tgz j2.tgz\n '\n \n test_expect_success GZIP 'infer tgz from .tar.gz filename' '\n \tgit archive --output=j3.tar.gz HEAD &&\n-\ttest_cmp j.tgz j3.tar.gz\n+\ttest_cmp_bin j.tgz j3.tar.gz\n '\n \n test_expect_success GZIP 'extract tgz file' '\n \tgzip -d -c <j.tgz >j.tar &&\n-\ttest_cmp b.tar j.tar\n+\ttest_cmp_bin b.tar j.tar\n '\n \n test_expect_success GZIP 'remote tar.gz is allowed by default' '\n \tgit archive --remote=. --format=tar.gz HEAD >remote.tar.gz &&\n-\ttest_cmp j.tgz remote.tar.gz\n+\ttest_cmp_bin j.tgz remote.tar.gz\n '\n \n test_expect_success GZIP 'remote tar.gz can be disabled' '\ndiff --git a/t/t5001-archive-attr.sh b/t/t5001-archive-attr.sh\nindex 51dedab..b04d955 100755\n--- a/t/t5001-archive-attr.sh\n+++ b/t/t5001-archive-attr.sh\n@@ -68,7 +68,7 @@ test_expect_missing\tworktree2/ignored-by-worktree\n \n test_expect_success 'git archive vs. bare' '\n \t(cd bare && git archive HEAD) >bare-archive.tar &&\n-\ttest_cmp archive.tar bare-archive.tar\n+\ttest_cmp_bin archive.tar bare-archive.tar\n '\n \n test_expect_success 'git archive with worktree attributes, bare' '\ndiff --git a/t/t5003-archive-zip.sh b/t/t5003-archive-zip.sh\nindex c72f71e..21a5c93 100755\n--- a/t/t5003-archive-zip.sh\n+++ b/t/t5003-archive-zip.sh\n@@ -97,15 +97,15 @@ test_expect_success \\\n \n test_expect_success \\\n     'git archive --format=zip vs. the same in a bare repo' \\\n-    'test_cmp d.zip d1.zip'\n+    'test_cmp_bin d.zip d1.zip'\n \n test_expect_success 'git archive --format=zip with --output' \\\n     'git archive --format=zip --output=d2.zip HEAD &&\n-    test_cmp d.zip d2.zip'\n+    test_cmp_bin d.zip d2.zip'\n \n test_expect_success 'git archive with --output, inferring format' '\n \tgit archive --output=d3.zip HEAD &&\n-\ttest_cmp d.zip d3.zip\n+\ttest_cmp_bin d.zip d3.zip\n '\n \n test_expect_success \\\ndiff --git a/t/t5004-archive-corner-cases.sh b/t/t5004-archive-corner-cases.sh\nindex 67f3b54..305bcac 100755\n--- a/t/t5004-archive-corner-cases.sh\n+++ b/t/t5004-archive-corner-cases.sh\n@@ -45,7 +45,7 @@ test_expect_success HEADER_ONLY_TAR_OK 'tar archive of commit with empty tree' '\n test_expect_success 'tar archive of empty tree is empty' '\n \tgit archive --format=tar HEAD: >empty.tar &&\n \tperl -e \"print \\\"\\\\0\\\" x 10240\" >10knuls.tar &&\n-\ttest_cmp 10knuls.tar empty.tar\n+\ttest_cmp_bin 10knuls.tar empty.tar\n '\n \n test_expect_success 'tar archive of empty tree with prefix' '\ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex 158e10a..cf7b41f 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -617,6 +617,12 @@ test_cmp() {\n \t$GIT_TEST_CMP \"$@\"\n }\n \n+# test_cmp_bin - helper to compare binary files\n+\n+test_cmp_bin() {\n+\tcmp \"$@\"\n+}\n+\n # Check if the file expected to be empty is indeed empty, and barfs\n # otherwise.\n \n-- \n2.0.0.9635.g0be03cb\n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/d/optout.\n"},{"id":"243314","messageId":"xmqq8upcv8jj.fsf@gitster.dls.corp.google.com","threadId":"36834","inReplyTo":"20140604155752.GA23226@camelia.ucw.cz","subject":"Re: [PATCH v2] t5000, t5003: do not use test_cmp to compare binary files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-06-04T18:22:56Z","receivedAt":"2014-06-04T18:22:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stepan Kasal <kasal@ucw.cz> writes:\n\n> test_cmp() is primarily meant to compare text files (and display the\n> difference for debug purposes).\n>\n> Raw \"cmp\" is better suited to compare binary files (tar, zip, etc.).\n>\n> On MinGW, test_cmp is a shell function mingw_test_cmp that tries to\n> read both files into environment, stripping CR characters (introduced\n> in commit 4d715ac0).\n>\n> This function usually speeds things up, as fork is extremly slow on\n> Windows.  But no wonder that this function is extremely slow and\n> sometimes even crashes when comparing large tar or zip files.\n>\n> Signed-off-by: Stepan Kasal <kasal@ucw.cz>\n> ---\n>\n> Hi Thomas,\n> On Wed, Jun 04, 2014 at 02:59:44PM +0200, Thomas Braun wrote:\n>> Using test_cmp_bin instead of cmp would result in then four assertions\n>> for comparing arbitrary data\n>> test_cmp\n>> test_i18ncmp\n>> test_cmp_text\n>> test_cmp_bin\n>> where I think the purpose of each function is clear from its name.\n>\n> [test_cmp_text does not exist (yet)]\n>\n> OK, I agree, hence this modified version of the patch.\n\nYeah, I think the above reasoning is sound.  And I do not think we\never need to have test_cmp_text -- our payload and our messages\ncompared by tests to make sure our expectations hold are text by\ndefault.\n\nWill queue; thanks.\n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/d/optout.\n"},{"id":"243361","messageId":"5268585.VtKVR75oeq@majorie","threadId":"36834","inReplyTo":"xmqq8upcv8jj.fsf@gitster.dls.corp.google.com","subject":"Re: Re: [PATCH v2] t5000, t5003: do not use test_cmp to compare binary files","fromName":"Michael Geddes","fromEmail":"michael@frog.wheelycreek.net","sentAt":"2014-06-05T02:01:50Z","receivedAt":"2014-06-05T02:01:50Z","isPatch":true,"sender":{"key":"michael@frog.wheelycreek.net","avatar":null},"body":"I have the problem that the overridden test_cmp crashes on a couple of places \nwhere it is doing a binary compare, so this is definitely needed.\n\nI actually used cmp -q   in my override as it's the return code that is most \nimportant.\n\n//.\n\nOn Wed, 4 Jun 2014 11:22:56 AM Junio C Hamano wrote:\n> Stepan Kasal <kasal@ucw.cz> writes:\n> > test_cmp() is primarily meant to compare text files (and display the\n> > difference for debug purposes).\n> > \n> > Raw \"cmp\" is better suited to compare binary files (tar, zip, etc.).\n> > \n> > On MinGW, test_cmp is a shell function mingw_test_cmp that tries to\n> > read both files into environment, stripping CR characters (introduced\n> > in commit 4d715ac0).\n> > \n> > This function usually speeds things up, as fork is extremly slow on\n> > Windows.  But no wonder that this function is extremely slow and\n> > sometimes even crashes when comparing large tar or zip files.\n> > \n> > Signed-off-by: Stepan Kasal <kasal@ucw.cz>\n> > ---\n> > \n> > Hi Thomas,\n> > \n> > On Wed, Jun 04, 2014 at 02:59:44PM +0200, Thomas Braun wrote:\n> >> Using test_cmp_bin instead of cmp would result in then four assertions\n> >> for comparing arbitrary data\n> >> test_cmp\n> >> test_i18ncmp\n> >> test_cmp_text\n> >> test_cmp_bin\n> >> where I think the purpose of each function is clear from its name.\n> > \n> > [test_cmp_text does not exist (yet)]\n> > \n> > OK, I agree, hence this modified version of the patch.\n> \n> Yeah, I think the above reasoning is sound.  And I do not think we\n> ever need to have test_cmp_text -- our payload and our messages\n> compared by tests to make sure our expectations hold are text by\n> default.\n> \n> Will queue; thanks.\n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/d/optout.\n"}]}