X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-cvsexportcommit.perl;h=59b672213bfc36f95db089f0e13bafc1c2f2ed71;hb=73d419558d9fa4de3be28bd58158636bc739808e;hp=9ec1df95c0aa8aba01990362c49ae1c15e2e086f;hpb=95ad2a65fbb9b7f26669fed9906fe9a1a531810b;p=git.git diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl index 9ec1df95c..59b672213 100755 --- a/git-cvsexportcommit.perl +++ b/git-cvsexportcommit.perl @@ -8,9 +8,9 @@ use File::Basename qw(basename dirname); use File::Spec; use Git; -our ($opt_h, $opt_P, $opt_p, $opt_v, $opt_c, $opt_f, $opt_a, $opt_m, $opt_d, $opt_u, $opt_w, $opt_W); +our ($opt_h, $opt_P, $opt_p, $opt_v, $opt_c, $opt_f, $opt_a, $opt_m, $opt_d, $opt_u, $opt_w, $opt_W, $opt_k); -getopts('uhPpvcfam:d:w:W'); +getopts('uhPpvcfkam:d:w:W'); $opt_h && usage(); @@ -259,7 +259,8 @@ if (@canstatusfiles) { if $file =~ /^no file / && $status eq 'Up-to-date'; - $cvsstat{$fullname{$file}} = $status; + $cvsstat{$fullname{$file}} = $status + if defined $fullname{$file}; } } } @@ -287,7 +288,26 @@ foreach my $f (@files) { $dirty = 1; warn "File $f not up to date but has status '$cvsstat{$f}' in your CVS checkout!\n"; } + + # Depending on how your GIT tree got imported from CVS you may + # have a conflict between expanded keywords in your CVS tree and + # unexpanded keywords in the patch about to be applied. + if ($opt_k) { + my $orig_file ="$f.orig"; + rename $f, $orig_file; + open(FILTER_IN, "<$orig_file") or die "Cannot open $orig_file\n"; + open(FILTER_OUT, ">$f") or die "Cannot open $f\n"; + while () + { + my $line = $_; + $line =~ s/\$([A-Z][a-z]+):[^\$]+\$/\$$1\$/g; + print FILTER_OUT $line; + } + close FILTER_IN; + close FILTER_OUT; + } } + if ($dirty) { if ($opt_f) { warn "The tree is not clean -- forced merge\n"; $dirty = 0; @@ -391,7 +411,7 @@ sleep(1); sub usage { print STDERR <