summaryrefslogtreecommitdiff
path: root/git-cvsexportcommit.perl
diff options
context:
space:
mode:
authorTomash Brechko <tomash.brechko@gmail.com>2007-04-09 15:24:02 +0400
committerJunio C Hamano <junkio@cox.net>2007-04-09 18:52:41 -0700
commitfc1f458c3506ea3f76a328f10b4008c45af32c4b (patch)
treed0ec37933d2d2e33aab8f255bb414161c6456477 /git-cvsexportcommit.perl
parent24c64d6add05f1f4d2e277af2d44c961910c98d3 (diff)
downloadgit-fc1f458c3506ea3f76a328f10b4008c45af32c4b.tar.gz
cvsexportcommit -p : fix the usage of git-apply -C.
Unlike 'patch --fuzz=NUM', which specifies the number of lines allowed to mismatch, 'git-apply -CNUM' requests the match of NUM lines of context. Omitting -C requests full context match, and that's what should be used for cvsexportcommit -p. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-cvsexportcommit.perl')
-rwxr-xr-xgit-cvsexportcommit.perl11
1 files changed, 8 insertions, 3 deletions
diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index 67224b4449..6ed471918d 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -124,12 +124,17 @@ close MSG;
`git-diff-tree --binary -p $parent $commit >.cvsexportcommit.diff`;# || die "Cannot diff";
## apply non-binary changes
-my $fuzz = $opt_p ? 0 : 2;
+
+# In pedantic mode require all lines of context to match. In normal
+# mode, be compatible with diff/patch: assume 3 lines of context and
+# require at least one line match, i.e. ignore at most 2 lines of
+# context, like diff/patch do by default.
+my $context = $opt_p ? '' : '-C1';
print "Checking if patch will apply\n";
my @stat;
-open APPLY, "GIT_DIR= git-apply -C$fuzz --binary --summary --numstat<.cvsexportcommit.diff|" || die "cannot patch";
+open APPLY, "GIT_DIR= git-apply $context --binary --summary --numstat<.cvsexportcommit.diff|" || die "cannot patch";
@stat=<APPLY>;
close APPLY || die "Cannot patch";
my (@bfiles,@files,@afiles,@dfiles);
@@ -196,7 +201,7 @@ if ($dirty) {
}
print "Applying\n";
-`GIT_DIR= git-apply -C$fuzz --binary --summary --numstat --apply <.cvsexportcommit.diff` || die "cannot patch";
+`GIT_DIR= git-apply $context --binary --summary --numstat --apply <.cvsexportcommit.diff` || die "cannot patch";
print "Patch applied successfully. Adding new files and directories to CVS\n";
my $dirtypatch = 0;