X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-cvsexportcommit.perl;h=6ed471918df25006314f3f2c6177bdd018757068;hb=d016a896d4a58a53dbb98cd85ebd033771413079;hp=d08216cfd7df47310e6eee155520d600a561d467;hpb=cc58fc0684396c5298b21c97f00a568e46224258;p=git.git diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl index d08216cfd..6ed471918 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=; 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; @@ -248,13 +253,14 @@ if ($opt_c) { die "Exiting: The commit did not succeed"; } print "Committed successfully to CVS\n"; + # clean up + unlink(".msg"); } else { print "Ready for you to commit, just run:\n\n $cmd\n"; } # clean up unlink(".cvsexportcommit.diff"); -unlink(".msg"); sub usage { print STDERR <