{"thread":{"id":"7581","subject":"[PATCH (resend)] cvsexportcommit -p : fix the usage of git-apply -C.","startedAt":"2007-04-09T11:24:02Z","lastAt":"2007-04-10T01:52:32Z","messageCount":2,"participants":["Tomash Brechko","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"38928","messageId":"20070409112402.GD11593@moonlight.home","threadId":"7581","inReplyTo":null,"subject":"[PATCH (resend)] cvsexportcommit -p : fix the usage of git-apply -C.","fromName":"Tomash Brechko","fromEmail":"tomash.brechko@gmail.com","sentAt":"2007-04-09T11:24:02Z","receivedAt":"2007-04-09T11:24:02Z","isPatch":true,"sender":{"key":"tomash.brechko@gmail.com","avatar":null},"body":"Unlike 'patch --fuzz=NUM', which specifies the number of lines allowed\nto mismatch, 'git-apply -CNUM' requests the match of NUM lines of\ncontext.  Omitting -C requests full context match, and that's what\nshould be used for cvsexportcommit -p.\n---\n git-cvsexportcommit.perl |   11 ++++++++---\n 1 files changed, 8 insertions(+), 3 deletions(-)\n\ndiff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl\nindex 67224b4..6ed4719 100755\n--- a/git-cvsexportcommit.perl\n+++ b/git-cvsexportcommit.perl\n@@ -124,12 +124,17 @@ close MSG;\n `git-diff-tree --binary -p $parent $commit >.cvsexportcommit.diff`;# || die \"Cannot diff\";\n \n ## apply non-binary changes\n-my $fuzz = $opt_p ? 0 : 2;\n+\n+# In pedantic mode require all lines of context to match.  In normal\n+# mode, be compatible with diff/patch: assume 3 lines of context and\n+# require at least one line match, i.e. ignore at most 2 lines of\n+# context, like diff/patch do by default.\n+my $context = $opt_p ? '' : '-C1';\n \n print \"Checking if patch will apply\\n\";\n \n my @stat;\n-open APPLY, \"GIT_DIR= git-apply -C$fuzz --binary --summary --numstat<.cvsexportcommit.diff|\" || die \"cannot patch\";\n+open APPLY, \"GIT_DIR= git-apply $context --binary --summary --numstat<.cvsexportcommit.diff|\" || die \"cannot patch\";\n @stat=<APPLY>;\n close APPLY || die \"Cannot patch\";\n my (@bfiles,@files,@afiles,@dfiles);\n@@ -196,7 +201,7 @@ if ($dirty) {\n }\n \n print \"Applying\\n\";\n-`GIT_DIR= git-apply -C$fuzz --binary --summary --numstat --apply <.cvsexportcommit.diff` || die \"cannot patch\";\n+`GIT_DIR= git-apply $context --binary --summary --numstat --apply <.cvsexportcommit.diff` || die \"cannot patch\";\n \n print \"Patch applied successfully. Adding new files and directories to CVS\\n\";\n my $dirtypatch = 0;\n-- \n1.5.1.82.g46af1-dirty\n"},{"id":"38982","messageId":"7v7islxafz.fsf@assigned-by-dhcp.cox.net","threadId":"7581","inReplyTo":"20070409112402.GD11593@moonlight.home","subject":"Re: [PATCH (resend)] cvsexportcommit -p : fix the usage of git-apply -C.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-10T01:52:32Z","receivedAt":"2007-04-10T01:52:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.  Looks very sane.\n"}]}