{"thread":{"id":"2526","subject":"stgit truncates binary files to zero length when applying patches","startedAt":"2005-11-15T14:42:23Z","lastAt":"2005-11-18T20:09:27Z","messageCount":35,"participants":["Karl Hasselström","Catalin Marinas","Junio C Hamano","Alex Riesen","Johannes Schindelin","John Benes","A Large Angry SCM","timo@dspsrv.com"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"11896","messageId":"20051115144223.GA18111@diana.vm.bytemark.co.uk","threadId":"2526","inReplyTo":null,"subject":"stgit truncates binary files to zero length when applying patches","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2005-11-15T14:42:23Z","receivedAt":"2005-11-15T14:42:23Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"When applying patches and not fast-forwarding, stgit truncates the\nbinary files to zero length:\n\n  $ cg-init .\n  defaulting to local storage area\n  Committing initial tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904\n  Committed as 73161b6ee428ac8b1c1b16b560c40e13330693d2.\n\n  $ stg init\n\n  $ stg new foo\n  Invoking the editor: \"emacs .stgit.msg\"... done (exit code: 0)\n\n  $ cp /bin/bash .\n\n  $ stg add bash\n\n  $ stg refresh\n  Refreshing patch \"foo\"... done\n\n  $ ls -l\n  total 584\n  -rwxr-xr-x  1 kha vtech 593304 Nov 15 15:34 bash*\n\n  $ stg pop\n  Popping patch \"foo\"... done\n  No patches applied\n\n  $ stg new bar\n  Invoking the editor: \"emacs .stgit.msg\"... done (exit code: 0)\n\n  $ echo bar > bar.txt\n\n  $ stg add bar.txt\n\n  $ stg refresh\n  Refreshing patch \"bar\"... done\n\n  $ stg push foo\n  Pushing patch \"foo\"... done\n  Now at patch \"foo\"\n\n  $ ls -l\n  total 4\n  -rw-r--r--  1 kha vtech 4 Nov 15 15:34 bar.txt\n  -rwxr-xr-x  1 kha vtech 0 Nov 15 15:35 bash*\n\nWithout the \"bar\" patch, popping and then pushing \"foo\" works as\nexpected.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"12010","messageId":"b0943d9e0511160311k725526d8v@mail.gmail.com","threadId":"2526","inReplyTo":"20051115144223.GA18111@diana.vm.bytemark.co.uk","subject":"Re: stgit truncates binary files to zero length when applying patches","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2005-11-16T11:11:56Z","receivedAt":"2005-11-16T11:11:56Z","isPatch":false,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 15/11/05, Karl Hasselström <kha@treskal.com> wrote:\n> When applying patches and not fast-forwarding, stgit truncates the\n> binary files to zero length:\n\nI've never tried binaries with StGIT before. When pushing a patch, if\na merge is needed (like in your case, the base of the foo patch has\nchanged), StGIT first tries \"git-diff-tree | git-apply\" for speed\nreasons. If this fails, it falls back to a three-way merge.\n\nUnfortunately, git-apply doesn't fail for patches including binary\nfiles and simply creates an empty file. I think git-apply should be\nchanged to fail to apply this kind of patches.\n\n--\nCatalin\n"},{"id":"12011","messageId":"20051116115449.GA5933@diana.vm.bytemark.co.uk","threadId":"2526","inReplyTo":"b0943d9e0511160311k725526d8v@mail.gmail.com","subject":"Re: stgit truncates binary files to zero length when applying patches","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2005-11-16T11:54:49Z","receivedAt":"2005-11-16T11:54:49Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2005-11-16 11:11:56 +0000, Catalin Marinas wrote:\n\n> On 15/11/05, Karl Hasselström <kha@treskal.com> wrote:\n>\n> > When applying patches and not fast-forwarding, stgit truncates the\n> > binary files to zero length:\n>\n> I've never tried binaries with StGIT before.\n\nI don't blame you. Binary patches aren't something I normally create\neither. It's just that I find stgit patches a good way to logically\nstructure a largeish change that I'm working on before committing it.\n(I could probably accoplish the same thing with one branch instead of\neach stgit patch, but then it would be quite a lot of work to manually\npush updates through all the branches.)\n\n> When pushing a patch, if a merge is needed (like in your case, the\n> base of the foo patch has changed), StGIT first tries \"git-diff-tree\n> | git-apply\" for speed reasons. If this fails, it falls back to a\n> three-way merge.\n>\n> Unfortunately, git-apply doesn't fail for patches including binary\n> files and simply creates an empty file. I think git-apply should be\n> changed to fail to apply this kind of patches.\n\nYes, at least if stgit is going to continue to use it like this.\nRefusing to handle binary files is somewhat disappointing, but still\nOK; agreeing to handle them and then silently wiping them is a bit\nless OK. (But don't worry; it is a perfect world, after all, so of\ncourse I had backups. :-)\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"12013","messageId":"b0943d9e0511160431r6c852e5fn@mail.gmail.com","threadId":"2526","inReplyTo":"20051116115449.GA5933@diana.vm.bytemark.co.uk","subject":"Re: stgit truncates binary files to zero length when applying patches","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2005-11-16T12:31:27Z","receivedAt":"2005-11-16T12:31:27Z","isPatch":false,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 16/11/05, Karl Hasselström <kha@treskal.com> wrote:\n> On 2005-11-16 11:11:56 +0000, Catalin Marinas wrote:\n> > Unfortunately, git-apply doesn't fail for patches including binary\n> > files and simply creates an empty file. I think git-apply should be\n> > changed to fail to apply this kind of patches.\n>\n> Yes, at least if stgit is going to continue to use it like this.\n> Refusing to handle binary files is somewhat disappointing, but still\n> OK; agreeing to handle them and then silently wiping them is a bit\n> less OK.\n\nA workaround for this would be to add a config option for StGIT to\nalways use the three-way merge for pushing patches. The problem with\nthis is speed since git-diff-tree | git-apply is much faster (and\npretty safe since fuzzy patching is not allowed) and most of the\npatches would apply cleanly with only this.\n\n--\nCatalin\n"},{"id":"12014","messageId":"20051116130332.GA6744@diana.vm.bytemark.co.uk","threadId":"2526","inReplyTo":"b0943d9e0511160431r6c852e5fn@mail.gmail.com","subject":"Re: stgit truncates binary files to zero length when applying patches","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2005-11-16T13:03:33Z","receivedAt":"2005-11-16T13:03:33Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2005-11-16 12:31:27 +0000, Catalin Marinas wrote:\n\n> On 16/11/05, Karl Hasselström <kha@treskal.com> wrote:\n>\n> > On 2005-11-16 11:11:56 +0000, Catalin Marinas wrote:\n> >\n> > > Unfortunately, git-apply doesn't fail for patches including\n> > > binary files and simply creates an empty file. I think git-apply\n> > > should be changed to fail to apply this kind of patches.\n> >\n> > Yes, at least if stgit is going to continue to use it like this.\n> > Refusing to handle binary files is somewhat disappointing, but\n> > still OK; agreeing to handle them and then silently wiping them is\n> > a bit less OK.\n>\n> A workaround for this would be to add a config option for StGIT to\n> always use the three-way merge for pushing patches. The problem with\n> this is speed since git-diff-tree | git-apply is much faster (and\n> pretty safe since fuzzy patching is not allowed) and most of the\n> patches would apply cleanly with only this.\n\nThe proper fix has to be to convince git-apply to either handle\npatches with binary files, or to make it fail; in both cases, stgit\nwill be fine. If the former is somehow intractable or undesirable, and\nthe latter would break existing callers (and/or inconvenience users),\nperhaps it could fail on binary files only when a --text-only flag was\ngiven.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"12027","messageId":"7vr79g8mys.fsf@assigned-by-dhcp.cox.net","threadId":"2526","inReplyTo":"b0943d9e0511160311k725526d8v@mail.gmail.com","subject":"Re: stgit truncates binary files to zero length when applying patches","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-16T18:30:19Z","receivedAt":"2005-11-16T18:30:19Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Catalin Marinas <catalin.marinas@gmail.com> writes:\n\n> ... When pushing a patch, if\n> a merge is needed (like in your case, the base of the foo patch has\n> changed), StGIT first tries \"git-diff-tree | git-apply\" for speed\n> reasons. If this fails, it falls back to a three-way merge.\n\nI think many of the scripts rely on git-apply failing reliably\nfor unapplicable patches.  I'll do a new test script in git.git/t\nand if it fails on binary files, try to fix it today.\n\nIncidentally, for the last couple of days, I was working on\nadding a very limited binary file diff support to \"diff piped to\napply\" pattern, and the result has been posted as \"reworked\nrebase\" patches.  It is very limited in the sense that the diff\noutput does not attempt to be useful if the patch consumer does\nnot have both pre- and post-image blob, but for the use of\nStGIT's internal patch replaying purposes that is not a concern,\nso you might be interested in taking a look.\n"},{"id":"12052","messageId":"7vmzk444u4.fsf_-_@assigned-by-dhcp.cox.net","threadId":"2526","inReplyTo":"7vr79g8mys.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] git-apply: fail if a patch cannot be applied.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-16T22:15:31Z","receivedAt":"2005-11-16T22:15:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Recently we fixed 'git-apply --stat' not to barf on a binary\ndifferences.  But it accidentally broke the error detection when\nwe actually attempt to apply them.\n\nThis commit fixes the problem and adds test cases.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\n\n Junio C Hamano <junkio@cox.net> writes:\n\n > Catalin Marinas <catalin.marinas@gmail.com> writes:\n >\n >> ... When pushing a patch, if\n >> a merge is needed (like in your case, the base of the foo patch has\n >> changed), StGIT first tries \"git-diff-tree | git-apply\" for speed\n >> reasons. If this fails, it falls back to a three-way merge.\n >\n > I think many of the scripts rely on git-apply failing reliably\n > for unapplicable patches.  I'll do a new test script in git.git/t\n > and if it fails on binary files, try to fix it today.\n\n apply.c                 |   11 ++++---\n t/t4103-apply-binary.sh |   78 +++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 85 insertions(+), 4 deletions(-)\n create mode 100644 t/t4103-apply-binary.sh\n\napplies-to: 4dda103301d7b70ec6e6e361d4a8d2cac24eccb4\n92927ed0aac56a86f85049215791fcd106af4b62\ndiff --git a/apply.c b/apply.c\nindex 590adc6..a002e15 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -891,7 +891,7 @@ static int parse_chunk(char *buffer, uns\n \n \tpatchsize = parse_single_patch(buffer + offset + hdrsize, size - offset - hdrsize, patch);\n \n-\tif (!patchsize && !metadata_changes(patch)) {\n+\tif (!patchsize) {\n \t\tstatic const char binhdr[] = \"Binary files \";\n \n \t\tif (sizeof(binhdr) - 1 < size - offset - hdrsize &&\n@@ -899,9 +899,12 @@ static int parse_chunk(char *buffer, uns\n \t\t\t    sizeof(binhdr)-1))\n \t\t\tpatch->is_binary = 1;\n \n-\t\tif (patch->is_binary && !apply && !check)\n-\t\t\t;\n-\t\telse\n+\t\t/* Empty patch cannot be applied if:\n+\t\t * - it is a binary patch or\n+\t\t * - metadata does not change and is not a binary patch.\n+\t\t */\n+\t\tif ((apply || check) &&\n+\t\t    (patch->is_binary || !metadata_changes(patch)))\n \t\t\tdie(\"patch with only garbage at line %d\", linenr);\n \t}\n \ndiff --git a/t/t4103-apply-binary.sh b/t/t4103-apply-binary.sh\nnew file mode 100644\nindex 0000000..948d5b5\n--- /dev/null\n+++ b/t/t4103-apply-binary.sh\n@@ -0,0 +1,78 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2005 Junio C Hamano\n+#\n+\n+test_description='git-apply handling binary patches\n+\n+'\n+. ./test-lib.sh\n+\n+# setup\n+\n+cat >file1 <<EOF\n+A quick brown fox jumps over the lazy dog.\n+A tiny little penguin runs around in circles.\n+There is a flag with Linux written on it.\n+A slow black-and-white panda just sits there,\n+munching on his bamboo.\n+EOF\n+cat file1 >file2\n+cat file1 >file4\n+\n+git-update-index --add --remove file1 file2 file4\n+git-commit -m 'Initial Version' 2>/dev/null\n+\n+git-checkout -b binary\n+tr 'x' '\\0' <file1 >file3\n+cat file3 >file4\n+git-add file2\n+tr '\\0' 'v' <file3 >file1\n+rm -f file2\n+git-update-index --add --remove file1 file2 file3 file4\n+git-commit -m 'Second Version'\n+\n+git-diff-tree -p master binary >B.diff\n+git-diff-tree -p -C master binary >C.diff\n+\n+test_expect_success 'stat binary diff -- should not fail.' \\\n+\t'git-checkout master\n+\t git-apply --stat --summary B.diff'\n+\n+test_expect_success 'stat binary diff (copy) -- should not fail.' \\\n+\t'git-checkout master\n+\t git-apply --stat --summary C.diff'\n+\n+test_expect_failure 'check binary diff -- should fail.' \\\n+\t'git-checkout master\n+\t git-apply --check B.diff'\n+\n+test_expect_failure 'check binary diff (copy) -- should fail.' \\\n+\t'git-checkout master\n+\t git-apply --check C.diff'\n+\n+# Now we start applying them.\n+\n+test_expect_failure 'apply binary diff -- should fail.' \\\n+\t'git-checkout master\n+\t git-apply B.diff'\n+\n+git-reset --hard\n+\n+test_expect_failure 'apply binary diff -- should fail.' \\\n+\t'git-checkout master\n+\t git-apply --index B.diff'\n+\n+git-reset --hard\n+\n+test_expect_failure 'apply binary diff (copy) -- should fail.' \\\n+\t'git-checkout master\n+\t git-apply C.diff'\n+\n+git-reset --hard\n+\n+test_expect_failure 'apply binary diff (copy) -- should fail.' \\\n+\t'git-checkout master\n+\t git-apply --index C.diff'\n+\n+test_done\n---\n0.99.9.GIT\n"},{"id":"12071","messageId":"7v7jb83w8m.fsf_-_@assigned-by-dhcp.cox.net","threadId":"2526","inReplyTo":"7vr79g8mys.fsf@assigned-by-dhcp.cox.net","subject":"master has some toys","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-17T01:21:13Z","receivedAt":"2005-11-17T01:21:13Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <junkio@cox.net> writes:\n\n> Incidentally, for the last couple of days, I was working on\n> adding a very limited binary file diff support to \"diff piped to\n> apply\" pattern, and the result has been posted as \"reworked\n> rebase\" patches.  It is very limited in the sense that the diff\n> output does not attempt to be useful if the patch consumer does\n> not have both pre- and post-image blob, but for the use of\n> StGIT's internal patch replaying purposes that is not a concern,\n> so you might be interested in taking a look.\n\nAlong with the git wrapper fixes and git-apply bugfix (it did\nnot fail when it saw unapplicable binary patches), and\ncvsexportcommit fixes from Kevin Geiss, I have the \"limited\nbinary patch support\" on the master branch.  The reworked rebase\nis still in proposed updates branch.\n\nI'll be offline for a couple of hours chaffering my wife.\n"},{"id":"12080","messageId":"81b0412b0511170029xac34cdbtddf74eb766281b3c@mail.gmail.com","threadId":"2526","inReplyTo":"7v7jb83w8m.fsf_-_@assigned-by-dhcp.cox.net","subject":"Re: master has some toys","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2005-11-17T08:29:03Z","receivedAt":"2005-11-17T08:29:03Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 11/17/05, Junio C Hamano <junkio@cox.net> wrote:\n> Along with the git wrapper fixes and git-apply bugfix (it did\n\ncygwin is completely broken. Still debugging, but it looks like the\nold \"windows can't unlink/rename open files\" problem.\n"},{"id":"12082","messageId":"7vy83ny450.fsf@assigned-by-dhcp.cox.net","threadId":"2526","inReplyTo":"81b0412b0511170029xac34cdbtddf74eb766281b3c@mail.gmail.com","subject":"Re: master has some toys","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-17T10:12:27Z","receivedAt":"2005-11-17T10:12:27Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alex Riesen <raa.lkml@gmail.com> writes:\n\n> cygwin is completely broken. Still debugging, but it looks like the\n> old \"windows can't unlink/rename open files\" problem.\n\nOuch.  Sorry, and thanks for reporting.\n\nIdeally I should get a cygwin environment myself, but for that\nfirst I need to procure Windows box.  Or does cygwin run on\nWine, and if so is cygwin running on Wine a good enough\napproximation of the real thing?\n"},{"id":"12086","messageId":"81b0412b0511170236r28572db9i84dc271700ded79a@mail.gmail.com","threadId":"2526","inReplyTo":"7vy83ny450.fsf@assigned-by-dhcp.cox.net","subject":"Re: master has some toys","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2005-11-17T10:36:31Z","receivedAt":"2005-11-17T10:36:31Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 11/17/05, Junio C Hamano <junkio@cox.net> wrote:\n> > cygwin is completely broken. Still debugging, but it looks like the\n> > old \"windows can't unlink/rename open files\" problem.\n>\n> Ouch.  Sorry, and thanks for reporting.\n\nAs it turned out, not the git.c is guilty, but the missing\nNO_MMAP=YesPlease in Cygwin section. I had it for a long time and\naccidentally removed by the recent pull. BTW, I couldn't find nowhere\non original branch. Was it never submitted?\n\n> Ideally I should get a cygwin environment myself, but for that\n> first I need to procure Windows box.  Or does cygwin run on\n> Wine, and if so is cygwin running on Wine a good enough\n> approximation of the real thing?\n\nI don't know. One should try real hard to create as much junk as there is.\n"},{"id":"12088","messageId":"7vwtj7wn7n.fsf@assigned-by-dhcp.cox.net","threadId":"2526","inReplyTo":"81b0412b0511170236r28572db9i84dc271700ded79a@mail.gmail.com","subject":"Re: master has some toys","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-17T11:03:24Z","receivedAt":"2005-11-17T11:03:24Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alex Riesen <raa.lkml@gmail.com> writes:\n\n> As it turned out, not the git.c is guilty, but the missing\n> NO_MMAP=YesPlease in Cygwin section. I had it for a long time and\n> accidentally removed by the recent pull. BTW, I couldn't find nowhere\n> on original branch. Was it never submitted?\n\nNeither 'git-whatchanged Makefile' nor 'git-whatchanged\n-SNO_MMAP Makefile' reports such on my end.  Do we need one?\n\nJohannes said he tests on Cygwin as well, and I am sure there\nare others with Cygin on the list.  Help us out here please?\n"},{"id":"12089","messageId":"Pine.LNX.4.63.0511171207580.20898@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2526","inReplyTo":"81b0412b0511170029xac34cdbtddf74eb766281b3c@mail.gmail.com","subject":"Re: master has some toys","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-11-17T11:08:20Z","receivedAt":"2005-11-17T11:08:20Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 17 Nov 2005, Alex Riesen wrote:\n\n> On 11/17/05, Junio C Hamano <junkio@cox.net> wrote:\n> > Along with the git wrapper fixes and git-apply bugfix (it did\n> \n> cygwin is completely broken. Still debugging, but it looks like the\n> old \"windows can't unlink/rename open files\" problem.\n\nFWIW I had no problems on cygwin (NO_MMAP=YesPlease).\n\nCiao,\nDscho\n"},{"id":"12091","messageId":"7vsltvwmlr.fsf@assigned-by-dhcp.cox.net","threadId":"2526","inReplyTo":"Pine.LNX.4.63.0511171207580.20898@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: master has some toys","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-17T11:16:32Z","receivedAt":"2005-11-17T11:16:32Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Hi,\n>\n> On Thu, 17 Nov 2005, Alex Riesen wrote:\n>\n>> On 11/17/05, Junio C Hamano <junkio@cox.net> wrote:\n>> > Along with the git wrapper fixes and git-apply bugfix (it did\n>> \n>> cygwin is completely broken. Still debugging, but it looks like the\n>> old \"windows can't unlink/rename open files\" problem.\n>\n> FWIW I had no problems on cygwin (NO_MMAP=YesPlease).\n\nIt appears we'd better have something like this in the main\nMakefile, so people do not have to do it themselves everywhere?\n\n---\n\ndiff --git a/Makefile b/Makefile\nindex 7ce62e8..93d51c6 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -213,6 +213,7 @@ endif\n ifeq ($(uname_O),Cygwin)\n \tNO_STRCASESTR = YesPlease\n \tNEEDS_LIBICONV = YesPlease\n+\tNO_MMAP = YesPlease\n \tNO_IPV6 = YesPlease\n \tX = .exe\n endif\n"},{"id":"12092","messageId":"81b0412b0511170320v5ad72ee2pb86bd22f247fd2e0@mail.gmail.com","threadId":"2526","inReplyTo":"Pine.LNX.4.63.0511171207580.20898@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: master has some toys","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2005-11-17T11:20:32Z","receivedAt":"2005-11-17T11:20:32Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 11/17/05, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> > > Along with the git wrapper fixes and git-apply bugfix (it did\n> >\n> > cygwin is completely broken. Still debugging, but it looks like the\n> > old \"windows can't unlink/rename open files\" problem.\n>\n> FWIW I had no problems on cygwin (NO_MMAP=YesPlease).\n>\n\nyes, that's what I had, too. Junio, how about the attached patch?\n"},{"id":"12093","messageId":"81b0412b0511170321q4dfa54c9x5daf6d95ac504e31@mail.gmail.com","threadId":"2526","inReplyTo":"7vsltvwmlr.fsf@assigned-by-dhcp.cox.net","subject":"Re: master has some toys","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2005-11-17T11:21:18Z","receivedAt":"2005-11-17T11:21:18Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 11/17/05, Junio C Hamano <junkio@cox.net> wrote:\n> >> > Along with the git wrapper fixes and git-apply bugfix (it did\n> >>\n> >> cygwin is completely broken. Still debugging, but it looks like the\n> >> old \"windows can't unlink/rename open files\" problem.\n> >\n> > FWIW I had no problems on cygwin (NO_MMAP=YesPlease).\n>\n> It appears we'd better have something like this in the main\n> Makefile, so people do not have to do it themselves everywhere?\n\ndamn... Missed by 4 minutes... :)\n"},{"id":"12094","messageId":"Pine.LNX.4.63.0511171216310.29989@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2526","inReplyTo":"81b0412b0511170236r28572db9i84dc271700ded79a@mail.gmail.com","subject":"Re: master has some toys","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-11-17T11:22:37Z","receivedAt":"2005-11-17T11:22:37Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 17 Nov 2005, Alex Riesen wrote:\n\n> As it turned out, not the git.c is guilty, but the missing\n> NO_MMAP=YesPlease in Cygwin section. I had it for a long time and\n> accidentally removed by the recent pull. BTW, I couldn't find nowhere\n> on original branch. Was it never submitted?\n\nIt was not, because someone (Peter?) had success without NO_MMAP=YesPlease \non cygwin. So it was decided to keep NO_MMAP an option which has to be \nprovided by the user.\n\n> > Ideally I should get a cygwin environment myself, but for that\n> > first I need to procure Windows box.  Or does cygwin run on\n> > Wine, and if so is cygwin running on Wine a good enough\n> > approximation of the real thing?\n\nIt does not. The problem with mmap is a problem which stems from working \naround Windows not being POSIX. Also note that the problem goes poof in a \ngdb session. I tend to think it is a timing problem in conjunction with \nthe (very conservative) Antivirus setting.\n\nCiao,\nDscho\n"},{"id":"12095","messageId":"Pine.LNX.4.63.0511171249550.737@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2526","inReplyTo":"7vsltvwmlr.fsf@assigned-by-dhcp.cox.net","subject":"Re: master has some toys","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-11-17T11:51:22Z","receivedAt":"2005-11-17T11:51:22Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 17 Nov 2005, Junio C Hamano wrote:\n\n> It appears we'd better have something like this in the main\n> Makefile, so people do not have to do it themselves everywhere?\n\nI'd like to wait to have a reaction from other people. I vividly remember \nmy eyes falling out of my sockets when somebody reported success on cygwin \nwithout NO_MMAP. If there is *any* cygwin version which fixes it, we \nshould rather make people upgrade, no?\n\nCiao,\nDscho\n"},{"id":"12098","messageId":"81b0412b0511170440l641a05b9q7b8957a36297315@mail.gmail.com","threadId":"2526","inReplyTo":"Pine.LNX.4.63.0511171249550.737@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: master has some toys","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2005-11-17T12:40:39Z","receivedAt":"2005-11-17T12:40:39Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 11/17/05, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> > It appears we'd better have something like this in the main\n> > Makefile, so people do not have to do it themselves everywhere?\n>\n> I'd like to wait to have a reaction from other people. I vividly remember\n> my eyes falling out of my sockets when somebody reported success on cygwin\n> without NO_MMAP. If there is *any* cygwin version which fixes it, we\n> should rather make people upgrade, no?\n\nmy eyes too. I used to compile Peters tree, and it never worked (w2k,\nantivirus present, but self-disabled because of some lucky crash).\nThat is why the whole story started (and I started to look for\nunclosed files and unmapped maps).\n"},{"id":"12130","messageId":"7vveyrt6ms.fsf@assigned-by-dhcp.cox.net","threadId":"2526","inReplyTo":"Pine.LNX.4.63.0511171249550.737@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: master has some toys","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-17T19:29:47Z","receivedAt":"2005-11-17T19:29:47Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> I'd like to wait to have a reaction from other people. I vividly remember \n> my eyes falling out of my sockets when somebody reported success on cygwin \n> without NO_MMAP. If there is *any* cygwin version which fixes it, we \n> should rather make people upgrade, no?\n\nI am not so sure about forcing people upgrade, but we may end up\ndeciding it is better not to have NO_MMAP as the default.  If\nthat turns out to be the case, I'd prefer to have something like\nthis instead:\n\ndiff --git a/Makefile b/Makefile\nindex 7ce62e8..215abf0 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -213,6 +213,10 @@ endif\n ifeq ($(uname_O),Cygwin)\n \tNO_STRCASESTR = YesPlease\n \tNEEDS_LIBICONV = YesPlease\n+\t# There are conflicting reports about this.\n+\t# On some boxes NO_MMAP is needed, and not so elsewhere.\n+\t# Try uncommenting this if you see things break -- YMMV.\n+\t# NO_MMAP = YesPlease\n \tNO_IPV6 = YesPlease\n \tX = .exe\n endif\n"},{"id":"12167","messageId":"Pine.LNX.4.63.0511180036200.18775@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2526","inReplyTo":"7vveyrt6ms.fsf@assigned-by-dhcp.cox.net","subject":"Re: master has some toys","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-11-17T23:36:52Z","receivedAt":"2005-11-17T23:36:52Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 17 Nov 2005, Junio C Hamano wrote:\n\n> +\t# There are conflicting reports about this.\n> +\t# On some boxes NO_MMAP is needed, and not so elsewhere.\n> +\t# Try uncommenting this if you see things break -- YMMV.\n> +\t# NO_MMAP = YesPlease\n\nSounds sensible. Maybe you want to output that to stderr or stdout?\n\nCiao,\nDscho\n"},{"id":"12172","messageId":"437D2D14.5080205@gmail.com","threadId":"2526","inReplyTo":"7vwtj7wn7n.fsf@assigned-by-dhcp.cox.net","subject":"Re: master has some toys","fromName":"John Benes","fromEmail":"smartcat99s@gmail.com","sentAt":"2005-11-18T01:23:32Z","receivedAt":"2005-11-18T01:23:32Z","isPatch":false,"sender":{"key":"smartcat99s@gmail.com","avatar":null},"body":"-----BEGIN PGP SIGNED MESSAGE-----\nHash: SHA1\n\nJunio C Hamano wrote:\n> Alex Riesen <raa.lkml@gmail.com> writes:\n> \n>> As it turned out, not the git.c is guilty, but the missing\n>> NO_MMAP=YesPlease in Cygwin section. I had it for a long time and\n>> accidentally removed by the recent pull. BTW, I couldn't find nowhere\n>> on original branch. Was it never submitted?\n> \n> Neither 'git-whatchanged Makefile' nor 'git-whatchanged\n> -SNO_MMAP Makefile' reports such on my end.  Do we need one?\n\nThe patch with the commented out option seems like it would work...\n\n> Johannes said he tests on Cygwin as well, and I am sure there\n> are others with Cygin on the list.  Help us out here please?\n\n\nI was able to compile master and pu on Cygwin without NO_MMAP=YesPlease\nin the Cygwin section.  However, the make test failed on the\nbinary-apply on both master and pu, output follows.\n\nCommit ID's used for testing:\nrefs/heads/master\t4e1da85d7d0480b6d9973317da4f7a5aa603fcb5\nrefs/heads/pu\t\t3b4587eb3c549649af7e84659b4808003c34c2d3\n\nmake test barfing on master:\n*** t4103-apply-binary.sh ***\n*   ok 1: stat binary diff -- should not fail.\n*   ok 2: stat binary diff (copy) -- should not fail.\n*   ok 3: check binary diff -- should fail.\n*   ok 4: check binary diff (copy) -- should fail.\n*   ok 5: check incomplete binary diff with replacement -- should fail.\n*   ok 6: check incomplete binary diff with replacement (copy) -- should\nfail.\n* FAIL 7: check binary diff with replacement.\n        git-checkout master\n                 git-apply --check --allow-binary-replacement BF.diff\n* FAIL 8: check binary diff with replacement (copy).\n        git-checkout master\n                 git-apply --check --allow-binary-replacement CF.diff\n*   ok 9: apply binary diff -- should fail.\n*   ok 10: apply binary diff -- should fail.\n*   ok 11: apply binary diff (copy) -- should fail.\n*   ok 12: apply binary diff (copy) -- should fail.\n*   ok 13: apply binary diff without replacement -- should fail.\n*   ok 14: apply binary diff without replacement (copy) -- should fail.\n* FAIL 15: apply binary diff.\n        do_reset\n                 git-apply --allow-binary-replacement --index BF.diff &&\n                 test -z \"$(git-diff --name-status binary)\"\n* FAIL 16: apply binary diff (copy).\n        do_reset\n                 git-apply --allow-binary-replacement --index CF.diff &&\n                 test -z \"$(git-diff --name-status binary)\"\n* failed 4 among 16 test(s)\nmake[1]: *** [t4103-apply-binary.sh] Error 1\n\nmake test barfing on pu:\n*** t4103-apply-binary.sh ***\nusage: git-diff-tree [--stdin] [-m] [-s] [-v] [--pretty] [-t] [-r]\n[--root] [<co\nmmon diff options>] <tree-ish> [<tree-ish>] [<path>...]\n***SNIP***\n\nusage: git-diff-tree [--stdin] [-m] [-s] [-v] [--pretty] [-t] [-r]\n[--root] [<co\nmmon diff options>] <tree-ish> [<tree-ish>] [<path>...]\n***SNIP***\n\n* FAIL 1: stat binary diff -- should not fail.\n        git-checkout master\n                 git-apply --stat --summary B.diff\n* FAIL 2: stat binary diff (copy) -- should not fail.\n        git-checkout master\n                 git-apply --stat --summary C.diff\n*   ok 3: check binary diff -- should fail.\n*   ok 4: check binary diff (copy) -- should fail.\n*   ok 5: check incomplete binary diff with replacement -- should fail.\n*   ok 6: check incomplete binary diff with replacement (copy) -- should\nfail.\n* FAIL 7: check binary diff with replacement.\n        git-checkout master\n                 git-apply --check --allow-binary-replacement BF.diff\n* FAIL 8: check binary diff with replacement (copy).\n        git-checkout master\n                 git-apply --check --allow-binary-replacement CF.diff\n*   ok 9: apply binary diff -- should fail.\n*   ok 10: apply binary diff -- should fail.\n*   ok 11: apply binary diff (copy) -- should fail.\n*   ok 12: apply binary diff (copy) -- should fail.\n*   ok 13: apply binary diff without replacement -- should fail.\n*   ok 14: apply binary diff without replacement (copy) -- should fail.\n* FAIL 15: apply binary diff.\n        do_reset\n                 git-apply --allow-binary-replacement --index BF.diff &&\n                 test -z \"$(git-diff --name-status binary)\"\n* FAIL 16: apply binary diff (copy).\n        do_reset\n                 git-apply --allow-binary-replacement --index CF.diff &&\n                 test -z \"$(git-diff --name-status binary)\"\n* failed 6 among 16 test(s)\nmake[1]: *** [t4103-apply-binary.sh] Error 1\n\n- --\nJohn Benes\nGPG Fingerprint: D519 25DB BB5C 38FC 9D02  02E7 596D BC50 F880 27FA\n\"It is not only the living who are killed in war.\" - Isaac Asimov\n-----BEGIN PGP SIGNATURE-----\nVersion: GnuPG v1.4.1 (MingW32)\nComment: Using GnuPG with Mozilla - http://enigmail.mozdev.org\n\niQIVAwUBQ30tE2F0oWcU9kCNAQKzRQ/8DEoZTRYDcU80mzddq8AS8ClctLx8CorY\nOJYY/sTAivjot7R/bPUj97Ie+FaUKC0mpTOGZTT8KkSpRg2mbZ6YlTUoHAtf4iq3\nF9vQs2qVJqyUJqbXcP+X68huIZF7vHZI47e9ExTO1RrxZCGxDp8JigfhmlS4CN4K\nDee1NSMnoWGklNEXvZMwkvhLerV+9Xs6UTGZ5AeRHRiHiLqK+I9eDNaULABHwAYO\nJSsat0HDjKMKrgNNFo43TpRTm17gq7N83LOJJkxiNYnRPh8nGpIOgfNx8riWP5DB\ntMw3FWvA9bv3tllvTFC4wx92Rgfs255cvXEunqfRTsMzGG7rhdg4UY92I0yB8k6b\ng6nucu93VtwEkHZ1b9ZTBwz85ZuTImS/72pHbRPvOaeSuDArBI9i+Lwrb+z+0vUS\niMMuAxtWhKUFr87A6ljdu27IfE+pJaEgGEySGkquU3EexuNRMz62raveRsEpLSu8\niqbKoMeC1A7CtcbV3OBdktfFyM3rR8/G9OpjBNdkojo08BOvsoMCU45jLdXFIFtu\nMGMajhGEu8EwAdItq6Qq0fXOfU6ph5oN4tg1pKt83QDkDFJyEJzOH1CMLh+qxXR3\nm25wLSJcV8YbNfQVMumw2aFXn3ojwkP3kEheoTKexTFVkwGS0dU/j9kpQ8wj9Pqv\n1ttxTdlX2HM=\n=OthK\n-----END PGP SIGNATURE-----\n"},{"id":"12175","messageId":"Pine.LNX.4.63.0511180345450.6359@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2526","inReplyTo":"437D2D14.5080205@gmail.com","subject":"Re: master has some toys","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-11-18T02:48:57Z","receivedAt":"2005-11-18T02:48:57Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 17 Nov 2005, John Benes wrote:\n\n> I was able to compile master and pu on Cygwin without NO_MMAP=YesPlease\n> in the Cygwin section.  However, the make test failed on the\n> binary-apply on both master and pu, output follows.\n\nNobody doubts that you can *compile* it. The problem is the fixing of the \nmmap()ed regions after fork(). Since win32 is such a sane system, it does \nnot provide mmap() or fork() out of the box. And under some very obscure \ncircumstances, cygwin's emulation of mmap() and fork() fails.\n\nBTW, it would be more helpful if you do not just tell *what* test fails, \nbut *how*. For example, try to run \"git-whatchanged -p\" and send just \nthe first page of the output (both stdout and stderr). I bet it says it \nhas a problem fixing up mmap() after fork().\n\nHth,\nDscho\n"},{"id":"12179","messageId":"7vfypur5jb.fsf@assigned-by-dhcp.cox.net","threadId":"2526","inReplyTo":"437D2D14.5080205@gmail.com","subject":"Re: master has some toys","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-18T03:36:24Z","receivedAt":"2005-11-18T03:36:24Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"John Benes <smartcat99s@gmail.com> writes:\n\n> Junio C Hamano wrote:\n>\n> I was able to compile master and pu on Cygwin without NO_MMAP=YesPlease\n> in the Cygwin section.  However, the make test failed on the\n> binary-apply on both master and pu, output follows.\n>\n> Commit ID's used for testing:\n> refs/heads/master\t4e1da85d7d0480b6d9973317da4f7a5aa603fcb5\n> refs/heads/pu\t\t3b4587eb3c549649af7e84659b4808003c34c2d3\n\nThanks.  But the test result look suspicious for pu.\n\n\t$ git-ls-tree 3b4587eb t | grep t4103\n\noutputs empty, so what you tested does not seem to be that\ncommit.\n\nAnyway, the master is more important at this point.\n\n> make test barfing on master:\n> *** t4103-apply-binary.sh ***\n> * FAIL 7: check binary diff with replacement.\n>         git-checkout master\n>                  git-apply --check --allow-binary-replacement BF.diff\n> * FAIL 8: check binary diff with replacement (copy).\n>         git-checkout master\n>                  git-apply --check --allow-binary-replacement CF.diff\n> * FAIL 15: apply binary diff.\n>         do_reset\n>                  git-apply --allow-binary-replacement --index BF.diff &&\n>                  test -z \"$(git-diff --name-status binary)\"\n> * FAIL 16: apply binary diff (copy).\n>         do_reset\n>                  git-apply --allow-binary-replacement --index CF.diff &&\n>                  test -z \"$(git-diff --name-status binary)\"\n> * failed 4 among 16 test(s)\n> make[1]: *** [t4103-apply-binary.sh] Error 1\n\nSo it fails on these binary diffs with full index tests.  Could\nyou try running it like this?\n\n\t$ cd t\n        $ sh ./t4103-apply-binary.sh -i -v\n\nIf all things being equal, this will stop at the first failing\ntest \"* FAIL 7: \", and you will have trash/ directory under t/.\n\n\t$ cd trash\n\t$ ls -l\n\nI would first want to see if it was diff that failed or the\napply.  What does BF.diff contain?\n"},{"id":"12180","messageId":"437D4F57.9070303@gmail.com","threadId":"2526","inReplyTo":"7vfypur5jb.fsf@assigned-by-dhcp.cox.net","subject":"Re: master has some toys","fromName":"A Large Angry SCM","fromEmail":"gitzilla@gmail.com","sentAt":"2005-11-18T03:49:43Z","receivedAt":"2005-11-18T03:49:43Z","isPatch":false,"sender":{"key":"gitzilla@gmail.com","avatar":"https://gravatar.com/avatar/354625c442439908ff3dd99757dee330e29e9df7847472384faf7a00add247fb?d=mp&s=160"},"body":"Junio C Hamano wrote:\n> John Benes <smartcat99s@gmail.com> writes:\n> \n>>Junio C Hamano wrote:\n>>\n>>I was able to compile master and pu on Cygwin without NO_MMAP=YesPlease\n>>in the Cygwin section.  However, the make test failed on the\n>>binary-apply on both master and pu, output follows.\n>>\n>>Commit ID's used for testing:\n>>refs/heads/master\t4e1da85d7d0480b6d9973317da4f7a5aa603fcb5\n>>refs/heads/pu\t\t3b4587eb3c549649af7e84659b4808003c34c2d3\n> \n> Thanks.  But the test result look suspicious for pu.\n> \n> \t$ git-ls-tree 3b4587eb t | grep t4103\n> \n> outputs empty, so what you tested does not seem to be that\n> commit.\n> \n> Anyway, the master is more important at this point.\n> \n>>make test barfing on master:\n>>*** t4103-apply-binary.sh ***\n>>* FAIL 7: check binary diff with replacement.\n>>        git-checkout master\n>>                 git-apply --check --allow-binary-replacement BF.diff\n>>* FAIL 8: check binary diff with replacement (copy).\n>>        git-checkout master\n>>                 git-apply --check --allow-binary-replacement CF.diff\n>>* FAIL 15: apply binary diff.\n>>        do_reset\n>>                 git-apply --allow-binary-replacement --index BF.diff &&\n>>                 test -z \"$(git-diff --name-status binary)\"\n>>* FAIL 16: apply binary diff (copy).\n>>        do_reset\n>>                 git-apply --allow-binary-replacement --index CF.diff &&\n>>                 test -z \"$(git-diff --name-status binary)\"\n>>* failed 4 among 16 test(s)\n>>make[1]: *** [t4103-apply-binary.sh] Error 1\n> \n> So it fails on these binary diffs with full index tests.  Could\n> you try running it like this?\n> \n> \t$ cd t\n>         $ sh ./t4103-apply-binary.sh -i -v\n> \n> If all things being equal, this will stop at the first failing\n> test \"* FAIL 7: \", and you will have trash/ directory under t/.\n> \n> \t$ cd trash\n> \t$ ls -l\n> \n> I would first want to see if it was diff that failed or the\n> apply.  What does BF.diff contain?\n> \n\nOK, here's what I get:\n\n > sh ./t4103-apply-binary.sh -i -v\n* expecting success: git-checkout master\n          git-apply --stat --summary B.diff\n  file1 |    4 ++--\n  file2 |    5 -----\n  file3 |    0\n  file4 |    0\n  4 files changed, 2 insertions(+), 7 deletions(-)\n  delete mode 100644 file2\n  create mode 100644 file3\n*   ok 1: stat binary diff -- should not fail.\n* expecting success: git-checkout master\n          git-apply --stat --summary C.diff\n  file1 |    4 ++--\n  file2 |    5 -----\n  file3 |    0\n  file4 |    0\n  4 files changed, 2 insertions(+), 7 deletions(-)\n  delete mode 100644 file2\n  copy file1 => file3 (70%)\n*   ok 2: stat binary diff (copy) -- should not fail.\n* expecting failure: git-checkout master\n          git-apply --check B.diff\nfatal: patch with only garbage at line 30\n*   ok 3: check binary diff -- should fail.\n* expecting failure: git-checkout master\n          git-apply --check C.diff\nfatal: patch with only garbage at line 32\n*   ok 4: check binary diff (copy) -- should fail.\n* expecting failure: git-checkout master\n          git-apply --check --allow-binary-replacement B.diff\nfatal: patch with only garbage at line 30\n*   ok 5: check incomplete binary diff with replacement -- should fail.\n* expecting failure: git-checkout master\n          git-apply --check --allow-binary-replacement C.diff\nfatal: patch with only garbage at line 32\n*   ok 6: check incomplete binary diff with replacement (copy) -- should \nfail.\n* expecting success: git-checkout master\n          git-apply --check --allow-binary-replacement BF.diff\nfatal: patch with only garbage at line 30\n* FAIL 7: check binary diff with replacement.\n         git-checkout master\n                  git-apply --check --allow-binary-replacement BF.diff\n > cd trash\ninternet@Gojira:~/GIT/git/t/trash> ls -l\ntotal 28\n-rw-r--r--  1 internet internet  909 2005-11-17 19:47 B.diff\n-rw-r--r--  1 internet internet 1173 2005-11-17 19:47 BF.diff\n-rw-r--r--  1 internet internet  944 2005-11-17 19:47 C.diff\n-rw-r--r--  1 internet internet 1208 2005-11-17 19:47 CF.diff\n-rw-r--r--  1 internet internet  201 2005-11-17 19:47 file1\n-rw-r--r--  1 internet internet  201 2005-11-17 19:47 file2\n-rw-r--r--  1 internet internet  201 2005-11-17 19:47 file4\n > cat BF.diff\ndiff --git a/file1 b/file1\nindex \nedc575dec543a684da5007b43886ee32ecb381ae..af1eedd35be991f3ced320f7d927799c72cd8435 \n100644\n--- a/file1\n+++ b/file1\n@@ -1,5 +1,5 @@\n-A quick brown fox jumps over the lazy dog.\n+A quick brown fov jumps over the lazy dog.\n  A tiny little penguin runs around in circles.\n-There is a flag with Linux written on it.\n+There is a flag with Linuv written on it.\n  A slow black-and-white panda just sits there,\n  munching on his bamboo.\ndiff --git a/file2 b/file2\ndeleted file mode 100644\nindex \nedc575dec543a684da5007b43886ee32ecb381ae..0000000000000000000000000000000000000000\n--- a/file2\n+++ /dev/null\n@@ -1,5 +0,0 @@\n-A quick brown fox jumps over the lazy dog.\n-A tiny little penguin runs around in circles.\n-There is a flag with Linux written on it.\n-A slow black-and-white panda just sits there,\n-munching on his bamboo.\ndiff --git a/file3 b/file3\nnew file mode 100644\nindex \n0000000000000000000000000000000000000000..adb07b7ad3fa2c63251b06d1d39cb90a85b860b4\nFiles /dev/null and b/file3 differ\ndiff --git a/file4 b/file4\nindex \nedc575dec543a684da5007b43886ee32ecb381ae..adb07b7ad3fa2c63251b06d1d39cb90a85b860b4 \n100644\nFiles a/file4 and b/file4 differ\n"},{"id":"12182","messageId":"437D5217.2050606@gmail.com","threadId":"2526","inReplyTo":"Pine.LNX.4.63.0511180345450.6359@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: master has some toys","fromName":"John Benes","fromEmail":"smartcat99s@gmail.com","sentAt":"2005-11-18T04:01:27Z","receivedAt":"2005-11-18T04:01:27Z","isPatch":false,"sender":{"key":"smartcat99s@gmail.com","avatar":null},"body":"-----BEGIN PGP SIGNED MESSAGE-----\nHash: SHA1\n\nJohannes Schindelin wrote:\n> BTW, it would be more helpful if you do not just tell *what* test fails, \n> but *how*. For example, try to run \"git-whatchanged -p\" and send just \n> the first page of the output (both stdout and stderr). I bet it says it \n> has a problem fixing up mmap() after fork().\n\nI ran \"git-whatchanged -p\" with the previously mentioned master build\ninstalled in /usr/bin.  Below is a copy of the command session.\n\nStdout was redirected to test2.txt, which is located at:\nhttp://www.penguinlounge.1and2.org/videos/test2.txt.bz2\n\nTwinkie@squirrel ~/git\n$ git-whatchanged -p > ../test2.txt\n\nTwinkie@squirrel ~/git\n$ cd ..\n\nTwinkie@squirrel ~\n$ ls -la test2.txt\n- -rw-r--r--  1 Twinkie None 9338905 Nov 17 21:23 test2.txt\n\n\nnothing was displayed on stderr.\n\n\nThe make test error was shown on linux too. [1]\nIt reports as:\nTwinkie@squirrel ~/git/t/trash\n$ git-apply --check --allow-binary-replacement BF.diff\nfatal: patch with only garbage at line 30\n\ncould it be an outdated diff? (2.8.7)\n\n[1] Re: \"make test\" fails with current HEAD @ 9:23PM CST by A Large\nAngry SCM\n\nAnything else you want me to bash this Cygwin install against?\n\n- --\nJohn Benes\nGPG Fingerprint: D519 25DB BB5C 38FC 9D02  02E7 596D BC50 F880 27FA\n\"It is not only the living who are killed in war.\" - Isaac Asimov\n-----BEGIN PGP SIGNATURE-----\nVersion: GnuPG v1.4.1 (MingW32)\nComment: Using GnuPG with Mozilla - http://enigmail.mozdev.org\n\niQIVAwUBQ31SF2F0oWcU9kCNAQKLUxAAtqOpSCsGSnNz+q9x8gzqaqjCK+mjjUkJ\nYJFalTEeNO9/alp3mPGb4kXwhMahyugGqHZzr2Lp5JC0gDSsn5vqF2sxYtB9yvAg\n1lg33awy5AI1LkIcbeiCvjkBI83UvIjOYLEs1YcIXKRDYJkcbo6yBN4uqkDZKAoS\nO8L3q2r2/mCJQYlANy1ruhT0Al5xPwTFNv6JqIkm8PWsPE+es6ZwyFBXKi62CHu5\nAWsc2nHDhPIx5YS1h7CIIQjiRh2qkf807IvXKZtY++o7yoHn49Rtu87VblZhkuH5\nUHOSE0gDbT37MbIg6hoZc20kBZIq1s+6e+/FhrFAUrmnny9t7fPaU35gJmPPA63W\nKajRKOwChmO6V5scTfgimxxzN4Jlnd+AM8FdxTWCfz6s4FLnnzukwX5T4PbWw6Kg\nif8fekhKkPYCLQtAa8Q6Xe5GIZJ5ghVRfAnZWhc4p8OJj6gacwGCk/QX0Rxu6z3r\nBF9e7RCyytwDw2Lw87NJFc7AYp4V4uINOAMMxPK0eidHOkkVVzu3eaoB8OIVzh5Q\noAwo+gPpd/PgFldJJu4i9e8bD8/J7cwZ0vpMkRDig9P1ZqFCj9t2+bAVzOgJPb80\n4YG/UR4VwVuKyYDeLhCHNLYJBssNXCCkN4+UKuLcNsk6+pXzniPVAc2Wda5BMIj2\nLV5oMRUCpKQ=\n=NFuc\n-----END PGP SIGNATURE-----\n"},{"id":"12181","messageId":"437D5219.6060300@gmail.com","threadId":"2526","inReplyTo":"7vfypur5jb.fsf@assigned-by-dhcp.cox.net","subject":"Re: master has some toys","fromName":"John Benes","fromEmail":"smartcat99s@gmail.com","sentAt":"2005-11-18T04:01:29Z","receivedAt":"2005-11-18T04:01:29Z","isPatch":false,"sender":{"key":"smartcat99s@gmail.com","avatar":null},"body":"-----BEGIN PGP SIGNED MESSAGE-----\nHash: SHA1\n\nJunio C Hamano wrote:\n> John Benes <smartcat99s AT gmail DOT com> writes:\n>> Commit ID's used for testing:\n>> refs/heads/master\t4e1da85d7d0480b6d9973317da4f7a5aa603fcb5\n>> refs/heads/pu\t\t3b4587eb3c549649af7e84659b4808003c34c2d3\n> \n> Thanks.  But the test result look suspicious for pu.\n\nI verified that I was testing that commit, and the ls-tree results.\nMust have been left over after switching from master...\n\n> Anyway, the master is more important at this point.\n\n> So it fails on these binary diffs with full index tests.  Could\n> you try running it like this?\n> \n> \t$ cd t\n>         $ sh ./t4103-apply-binary.sh -i -v\n> \n> If all things being equal, this will stop at the first failing\n> test \"* FAIL 7: \", and you will have trash/ directory under t/.\n> \n> \t$ cd trash\n> \t$ ls -l\n> \n> I would first want to see if it was diff that failed or the\n> apply.  What does BF.diff contain?\n> \n\nOutput from the commands requested:\n\nTwinkie@squirrel ~/git/t\n$ sh ./t4103-apply-binary.sh -i -v\nsh ./t4103-apply-binary.sh -i -v\n* expecting success: git-checkout master\n         git-apply --stat --summary B.diff\n file1 |    4 ++--\n file2 |    5 -----\n file3 |    0\n file4 |    0\n 4 files changed, 2 insertions(+), 7 deletions(-)\n delete mode 100644 file2\n create mode 100644 file3\n*   ok 1: stat binary diff -- should not fail.\n* expecting success: git-checkout master\n         git-apply --stat --summary C.diff\n file1 |    4 ++--\n file2 |    5 -----\n file3 |    0\n file4 |    0\n 4 files changed, 2 insertions(+), 7 deletions(-)\n delete mode 100644 file2\n copy file1 => file3 (70%)\n*   ok 2: stat binary diff (copy) -- should not fail.\n* expecting failure: git-checkout master\n         git-apply --check B.diff\nfatal: patch with only garbage at line 30\n*   ok 3: check binary diff -- should fail.\n* expecting failure: git-checkout master\n         git-apply --check C.diff\nfatal: patch with only garbage at line 32\n*   ok 4: check binary diff (copy) -- should fail.\n* expecting failure: git-checkout master\n         git-apply --check --allow-binary-replacement B.diff\nfatal: patch with only garbage at line 30\n*   ok 5: check incomplete binary diff with replacement -- should fail.\n* expecting failure: git-checkout master\n         git-apply --check --allow-binary-replacement C.diff\nfatal: patch with only garbage at line 32\n*   ok 6: check incomplete binary diff with replacement (copy) -- should\nfail.\n* expecting success: git-checkout master\n         git-apply --check --allow-binary-replacement BF.diff\nfatal: patch with only garbage at line 30\n* FAIL 7: check binary diff with replacement.\n        git-checkout master\n                 git-apply --check --allow-binary-replacement BF.diff\n\nTwinkie@squirrel ~/git/t\n$ cd trash\ncd trash\n\nTwinkie@squirrel ~/git/t/trash\n$ ls -l\nls -l\ntotal 19\n- -rw-r--r--  1 Twinkie None  909 Nov 17 21:49 B.diff\n- -rw-r--r--  1 Twinkie None 1173 Nov 17 21:49 BF.diff\n- -rw-r--r--  1 Twinkie None  944 Nov 17 21:49 C.diff\n- -rw-r--r--  1 Twinkie None 1208 Nov 17 21:49 CF.diff\n- -rw-r--r--  1 Twinkie None  201 Nov 17 21:49 file1\n- -rw-r--r--  1 Twinkie None  201 Nov 17 21:49 file2\n- -rw-r--r--  1 Twinkie None  201 Nov 17 21:49 file4\n\nTwinkie@squirrel ~/git/t/trash\n$ cat BF.diff\ncat BF.diff\ndiff --git a/file1 b/file1\nindex\nedc575dec543a684da5007b43886ee32ecb381ae..af1eedd35be991f3ced320f7d927799c\n72cd8435 100644\n- --- a/file1\n+++ b/file1\n@@ -1,5 +1,5 @@\n- -A quick brown fox jumps over the lazy dog.\n+A quick brown fov jumps over the lazy dog.\n A tiny little penguin runs around in circles.\n- -There is a flag with Linux written on it.\n+There is a flag with Linuv written on it.\n A slow black-and-white panda just sits there,\n munching on his bamboo.\ndiff --git a/file2 b/file2\ndeleted file mode 100644\nindex\nedc575dec543a684da5007b43886ee32ecb381ae..00000000000000000000000000000000\n00000000\n- --- a/file2\n+++ /dev/null\n@@ -1,5 +0,0 @@\n- -A quick brown fox jumps over the lazy dog.\n- -A tiny little penguin runs around in circles.\n- -There is a flag with Linux written on it.\n- -A slow black-and-white panda just sits there,\n- -munching on his bamboo.\ndiff --git a/file3 b/file3\nnew file mode 100644\nindex\n0000000000000000000000000000000000000000..adb07b7ad3fa2c63251b06d1d39cb90a\n85b860b4\nFiles /dev/null and b/file3 differ\ndiff --git a/file4 b/file4\nindex\nedc575dec543a684da5007b43886ee32ecb381ae..adb07b7ad3fa2c63251b06d1d39cb90a\n85b860b4 100644\nFiles a/file4 and b/file4 differ\n\nTwinkie@squirrel ~/git/t/trash\n$ git-apply BF.diff\nfatal: patch with only garbage at line 30\n\n- --\nJohn Benes\nGPG Fingerprint: D519 25DB BB5C 38FC 9D02  02E7 596D BC50 F880 27FA\n\"It is not only the living who are killed in war.\" - Isaac Asimov\n-----BEGIN PGP SIGNATURE-----\nVersion: GnuPG v1.4.1 (MingW32)\nComment: Using GnuPG with Mozilla - http://enigmail.mozdev.org\n\niQIVAwUBQ31SGGF0oWcU9kCNAQJmchAA0L9fnTvMNwYhDHRVdPyF6XQYJJ7j3s6M\nCtcjFvQZ0Zo2tp3ZZ8mqv9ANgPkV80HZFpWPwmlAouFQfNbjvEDlFxLejaKZ5TJj\nq068iMk8ZmUUHKPUhONhCsi/toXHQuhA7RMWEwtE9EeugOOIC/++eI8qhKzBhJr3\nREzLQN55lqrdhN/6ksrhJQU2VQ3AcAukgezrJy3j8CYOId3pVLYoyD75oxTrelnN\nxSPritxM/zkdQZYwx/WeSFRivQQZgiSwm2nREJ5NY5MJ8X5SIZJ+bcHSnndNmUYv\ne6YkZRPLXQBAyJpQHwmAQIqtYikPZ/Q6SNBoiQgA3Ws1SyzSaMcOo9R30Cg4LT4i\n37EtQwjrGXzY6V/YlHbPqauPlUW6Sosc7fadNXHXkJJrdgyGSATZghh+XEZpNQ1G\n2cS05y7/Xu9KnhL0GxbwLf9FZg14CndRh04NDtkdvwyE5rK9SCD5seW6HQOeBcuX\noHLPeA29IaZvHFUYTITXP5p2ZySAXrrFt7R532j6njeJvVCRzV7pPh7msHmAgdXL\nWz5Xv9ED43wz+q6JpXuWloYNyDKUUil2emXVA/MHwLW9ugfZmu9/OVo2ChXf+ZLH\n8pSGxRmxTAVSf0GIiODPMWmGrm2zsKbNczCY1wATjiRaYvlmRk1kiXpXpubW5bw9\nF1UDCLIFaJk=\n=Uh0t\n-----END PGP SIGNATURE-----\n"},{"id":"12183","messageId":"7vbr0ir387.fsf@assigned-by-dhcp.cox.net","threadId":"2526","inReplyTo":"437D4F57.9070303@gmail.com","subject":"Re: master has some toys","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-18T04:26:16Z","receivedAt":"2005-11-18T04:26:16Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"A Large Angry SCM <gitzilla@gmail.com> writes:\n\n> Files /dev/null and b/file3 differ\n> diff --git a/file4 b/file4\n> index \n> edc575dec543a684da5007b43886ee32ecb381ae..adb07b7ad3fa2c63251b06d1d39cb90a85b860b4 \n> 100644\n> Files a/file4 and b/file4 differ\n\nThanks.  I've seen enough.  I expected diff (GNU diffutils 2.8.1\nis what I have handy) output which says \"Binary files a/foo and\nb/foo differ\".\n\nHmph.  Now I'd need to find a way to catch at least these two\ncases...\n"},{"id":"12184","messageId":"7v7jb6r35s.fsf@assigned-by-dhcp.cox.net","threadId":"2526","inReplyTo":"437D5219.6060300@gmail.com","subject":"Re: master has some toys","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-18T04:27:43Z","receivedAt":"2005-11-18T04:27:43Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"John Benes <smartcat99s@gmail.com> writes:\n\n> diff --git a/file4 b/file4\n> index\n> edc575dec543a684da5007b43886ee32ecb381ae..adb07b7ad3fa2c63251b06d1d39cb90a\n> 85b860b4 100644\n> Files a/file4 and b/file4 differ\n\nThanks.  This is the same problem as what Large Angly SCM\nreports.  What does your \"diff --version\" say?\n"},{"id":"12185","messageId":"437D5A17.6050806@gmail.com","threadId":"2526","inReplyTo":"7v7jb6r35s.fsf@assigned-by-dhcp.cox.net","subject":"Re: master has some toys","fromName":"John Benes","fromEmail":"smartcat99s@gmail.com","sentAt":"2005-11-18T04:35:35Z","receivedAt":"2005-11-18T04:35:35Z","isPatch":false,"sender":{"key":"smartcat99s@gmail.com","avatar":null},"body":"-----BEGIN PGP SIGNED MESSAGE-----\nHash: SHA1\n\nJunio C Hamano wrote:\n> Thanks.  This is the same problem as what Large Angly SCM\n> reports.  What does your \"diff --version\" say?\n\nTwinkie@squirrel ~\n$ diff --version\ndiff (GNU diffutils) 2.8.7\nWritten by Paul Eggert, Mike Haertel, David Hayes,\nRichard Stallman, and Len Tower.\n[snip 2004 copyright notice]\n\nExtra useful info about my cygwin enviroment:\n\nTwinkie@squirrel ~\n$ cygcheck -V\ncygcheck version 1.74\nSystem Checker for Cygwin\nCopyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.\nCompiled on Jul  2 2005\n\ncygwin1.dll Version: 1.5.18\n\nHTH!\n\n- --\nJohn Benes\nGPG Fingerprint: D519 25DB BB5C 38FC 9D02  02E7 596D BC50 F880 27FA\n\"It is not only the living who are killed in war.\" - Isaac Asimov\n-----BEGIN PGP SIGNATURE-----\nVersion: GnuPG v1.4.1 (MingW32)\nComment: Using GnuPG with Mozilla - http://enigmail.mozdev.org\n\niQIVAwUBQ31aF2F0oWcU9kCNAQJrSRAAqDVQuCuF0PBn0ssGJA4sZ5fSa4S4hUju\nyftaR9dDaWqpML4ieMcp5NXD1HEm6yzJbL9WhGuDQlpolo7ujbiI1sx7jP53Au+3\nzm7iWojJVnRBirRAqsZpD2Ufriuzwnm6/rPJqe97RSkYIm29BcKsiSly67mFKEKJ\nAL/MiAmH62h7HLOjSRR2o+3eGmvMlAesojoLdoTaCkic5l34WIfv4EzSSTSfwS+O\ncn0K8MFqbuuApZTwECl5OdmAVbKGdC0PjgqgJQIEM39dWxKqqGrmSLvbs42AAEok\ntOPTdB+4O2ECEIIYtjiqUAZ2ZDwVvxJwEyTEt60tzvbcfX0TwfXaO+JDxd9gmr8P\nhe/f05NT+IlqFrcXyXD8PVc+29ZBr7ocM1k+VIzqclGIjHMO6VjytEO3xppbtEDz\niAA5MFYsCM5fiJRndNYiH51WvVMjmmY1SO6LJtqGiwZhX3/couMy71JorXeqGgaW\nYjrkvs8q9AtvTG3Nq9BpmJCz0kXHbMmULchooaNtpDlPVVti9CA08vJ/9PssWRfD\nMrkVkEijTpkw/lWClqW91aGWT9vlMeQSBVZf8Cr2Zg9DQNAFEE4LiVmlt10odZGw\ncE4TlhaCk2Z2X1AeuDTimyN7hL6FMVweMsLgio1XNpk/NOCGkgvXDo7R76MfU8PS\ndsT2ItOIm6w=\n=o9sa\n-----END PGP SIGNATURE-----\n"},{"id":"12186","messageId":"437D5B23.1070708@gmail.com","threadId":"2526","inReplyTo":"7v7jb6r35s.fsf@assigned-by-dhcp.cox.net","subject":"Re: master has some toys","fromName":"A Large Angry SCM","fromEmail":"gitzilla@gmail.com","sentAt":"2005-11-18T04:40:03Z","receivedAt":"2005-11-18T04:40:03Z","isPatch":false,"sender":{"key":"gitzilla@gmail.com","avatar":"https://gravatar.com/avatar/354625c442439908ff3dd99757dee330e29e9df7847472384faf7a00add247fb?d=mp&s=160"},"body":"Junio C Hamano wrote:\n> John Benes <smartcat99s@gmail.com> writes:\n> \n>>diff --git a/file4 b/file4\n>>index\n>>edc575dec543a684da5007b43886ee32ecb381ae..adb07b7ad3fa2c63251b06d1d39cb90a\n>>85b860b4 100644\n>>Files a/file4 and b/file4 differ\n> \n> Thanks.  This is the same problem as what Large Angly SCM\n> reports.  What does your \"diff --version\" say?\n\n\n > diff --version\ndiff (GNU diffutils) 2.8.7\nWritten by Paul Eggert, Mike Haertel, David Hayes,\nRichard Stallman, and Len Tower.\n\nCopyright (C) 2004 Free Software Foundation, Inc.\nThis is free software; see the source for copying conditions.  There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n >\n"},{"id":"12188","messageId":"7v1x1er2ai.fsf_-_@assigned-by-dhcp.cox.net","threadId":"2526","inReplyTo":"7vbr0ir387.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] Deal with binary diff output from (unknown version of) diff","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-18T04:46:29Z","receivedAt":"2005-11-18T04:46:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Some vintage of diff says just \"Files X and Y differ\\n\", instead\nof \"Binary files X and Y differ\\n\", so catch both patterns.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\n\n    Junio C Hamano <junkio@cox.net> writes:\n\n    >> Files /dev/null and b/file3 differ\n    >> diff --git a/file4 b/file4\n    >> index edc575d..adb07b7 100644\n    >> Files a/file4 and b/file4 differ\n    >\n    > Thanks.  I've seen enough.  I expected diff (GNU diffutils 2.8.1\n    > is what I have handy) output which says \"Binary files a/foo and\n    > b/foo differ\".\n    >\n    > Hmph.  Now I'd need to find a way to catch at least these two\n    > cases...\n\n    Could you two try this patch please?\n\ndiff --git a/apply.c b/apply.c\nindex 129edb1..50be8f3 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -893,12 +893,24 @@ static int parse_chunk(char *buffer, uns\n \tpatchsize = parse_single_patch(buffer + offset + hdrsize, size - offset - hdrsize, patch);\n \n \tif (!patchsize) {\n-\t\tstatic const char binhdr[] = \"Binary files \";\n-\n-\t\tif (sizeof(binhdr) - 1 < size - offset - hdrsize &&\n-\t\t    !memcmp(binhdr, buffer + hdrsize + offset,\n-\t\t\t    sizeof(binhdr)-1))\n-\t\t\tpatch->is_binary = 1;\n+\t\tstatic const char *binhdr[] = {\n+\t\t\t\"Binary files \",\n+\t\t\t\"Files \",\n+\t\t\tNULL,\n+\t\t};\n+\t\tint i;\n+\t\tint hd = hdrsize + offset;\n+\t\tunsigned long llen = linelen(buffer + hd, size - hd);\n+\n+\t\tif (!memcmp(\" differ\\n\", buffer + hd + llen - 8, 8))\n+\t\t\tfor (i = 0; binhdr[i]; i++) {\n+\t\t\t\tint len = strlen(binhdr[i]);\n+\t\t\t\tif (len < size - hd &&\n+\t\t\t\t    !memcmp(binhdr[i], buffer + hd, len)) {\n+\t\t\t\t\tpatch->is_binary = 1;\n+\t\t\t\t\tbreak;\n+\t\t\t\t}\n+\t\t\t}\n \n \t\t/* Empty patch cannot be applied if:\n \t\t * - it is a binary patch and we do not do binary_replace, or\n"},{"id":"12189","messageId":"437D5F72.8050100@gmail.com","threadId":"2526","inReplyTo":"7v1x1er2ai.fsf_-_@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Deal with binary diff output from (unknown version of) diff","fromName":"A Large Angry SCM","fromEmail":"gitzilla@gmail.com","sentAt":"2005-11-18T04:58:26Z","receivedAt":"2005-11-18T04:58:26Z","isPatch":true,"sender":{"key":"gitzilla@gmail.com","avatar":"https://gravatar.com/avatar/354625c442439908ff3dd99757dee330e29e9df7847472384faf7a00add247fb?d=mp&s=160"},"body":"Passed here!\n\n\nJunio C Hamano wrote:\n> Some vintage of diff says just \"Files X and Y differ\\n\", instead\n> of \"Binary files X and Y differ\\n\", so catch both patterns.\n> \n> Signed-off-by: Junio C Hamano <junkio@cox.net>\n> \n> ---\n> \n>     Junio C Hamano <junkio@cox.net> writes:\n> \n>     >> Files /dev/null and b/file3 differ\n>     >> diff --git a/file4 b/file4\n>     >> index edc575d..adb07b7 100644\n>     >> Files a/file4 and b/file4 differ\n>     >\n>     > Thanks.  I've seen enough.  I expected diff (GNU diffutils 2.8.1\n>     > is what I have handy) output which says \"Binary files a/foo and\n>     > b/foo differ\".\n>     >\n>     > Hmph.  Now I'd need to find a way to catch at least these two\n>     > cases...\n> \n>     Could you two try this patch please?\n\n[snip snip]\n"},{"id":"12217","messageId":"20051118120016.GD1920@ELSAMSW37164","threadId":"2526","inReplyTo":"Pine.LNX.4.63.0511171249550.737@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: master has some toys","fromName":"","fromEmail":"timo@dspsrv.com","sentAt":"2005-11-18T12:01:42Z","receivedAt":"2005-11-18T12:01:42Z","isPatch":false,"sender":{"key":"timo@dspsrv.com","avatar":null},"body":"On Thu, Nov 17, 2005 at 12:51:22PM +0100, Johannes Schindelin wrote:\n> Hi,\n> \n> On Thu, 17 Nov 2005, Junio C Hamano wrote:\n> \n> > It appears we'd better have something like this in the main\n> > Makefile, so people do not have to do it themselves everywhere?\n> \n> I'd like to wait to have a reaction from other people. I vividly remember \n> my eyes falling out of my sockets when somebody reported success on cygwin \n> without NO_MMAP. If there is *any* cygwin version which fixes it, we \n> should rather make people upgrade, no?\n> \n\nIt is not in the official Cygwin distribution yet. Though I've started the\nformalities, moving house as been taking all my spare time. So, the upgrade\nworries would be for those people tracking the main git repo. As they are\nalmost certainly on this list, they should be aware of possible breakage.\n\nI've noted some breakage with git-archimport, git-svnimport and git-cvsimport,\nthough i have not yet looked into it, some are due to the lack of necessary\ntools under Cygwin. I'm re-jigging my distro script to emulate the new package\nsplit and plan to distribute just the git 'core' stuff for the moment.\n\nI was wondering if anyone has scripts that i could use to test the\nsvn/arch/CVS import/export for expected behavior?\n\nTim.\n\"However beautiful the strategy, you should occasionally look at the results.\"\n-- Winston Churchill\n"},{"id":"12243","messageId":"7vu0e9hg5k.fsf@assigned-by-dhcp.cox.net","threadId":"2526","inReplyTo":"7vveyrt6ms.fsf@assigned-by-dhcp.cox.net","subject":"Re: master has some toys","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-18T20:09:27Z","receivedAt":"2005-11-18T20:09:27Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <junkio@cox.net> writes:\n\nI just had a small excitement finding out I did something right\nand felt an urge to brag ;-).\n\n> I am not so sure about forcing people upgrade, but we may end up\n> deciding it is better not to have NO_MMAP as the default.  If\n> that turns out to be the case, I'd prefer to have something like\n> this instead:\n>\n> diff --git a/Makefile b/Makefile\n> index 7ce62e8..215abf0 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -213,6 +213,10 @@ endif\n>  ifeq ($(uname_O),Cygwin)\n>  \tNO_STRCASESTR = YesPlease\n>  \tNEEDS_LIBICONV = YesPlease\n> +\t# There are conflicting reports about this.\n> +\t# On some boxes NO_MMAP is needed, and not so elsewhere.\n> +\t# Try uncommenting this if you see things break -- YMMV.\n> +\t# NO_MMAP = YesPlease\n>  \tNO_IPV6 = YesPlease\n>  \tX = .exe\n>  endif\n\nI did the above patch on top of \"pu\", which contained the patch\nfrom Pavel Roskin and sent it out.  Later I saved the message\nfrom my mbox, went back to the \"master\" branch, whose Makefile\nhad the releveant part like this:\n\n        ifeq ($(uname_O),Cygwin)\n                NO_STRCASESTR = YesPlease\n                NEEDS_LIBICONV = YesPlease\n                NO_IPV6 = YesPlease\n                X = .exe\n                ALL_CFLAGS += -DUSE_SYMLINK_HEAD=0\n        endif\n\nNotice ALL_CFLAGS line?  The patch does not apply cleanly and\nusual e-mail patch application tool would have barfed; git-apply\nwould not allow any fuzz, and patch would have dropped a .rej\nfile.\n\nHowever, I usually run \"git-am\" with --3way option enabled when\napplying the e-mailed patches.  After git-apply failed, it\nnoticed I am applying on top of a different blob, namely, the\nMakefile from somewhere else (it reads the \"index 7ce62e8\"),\nthen fell back on 3-way merge and made a clean commit.  Happy.\n\nBack to day-job.\n"}]}